Updating form from Access


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Updating form from Access

  1. #1
    Join Date
    Jan 2006
    Posts
    67

    Updating form from Access

    I am having probs filling my text boxes with filtered data. I first fill a combo box to get a customer name which fills another combo box with order numbers related to that customer. My problem is filling the text boxes with order details once an order number is selected. What am I doing wrong here? I am getting an IndexOutOfRange error at the bolded item.

    Private Sub Form1_Load
    'fill data set
    daCompany.Fill(dsCompanyObj)

    'Company combo box selects nothing at start up
    cbCompany.SelectedIndex = -1

    End Sub

    Private Sub cbCompany_SelectedIndexChanged
    'if selection has made
    If cbCompany.SelectedIndex <> -1 Then

    'enable the order number combo box
    cbOrderNum.Enabled = True

    'clear order number dataset
    dsOrderNumObj.Clear()

    'fill order number data set and combo box
    daOrderNum.SelectCommand.Parameters("CustomerID").Value = cbCompany.SelectedValue
    daOrderNum.Fill(dsOrderNumObj)

    ' Order number combo box does not select anything yet until changed
    cbOrderNum.SelectedIndex = -1

    End If
    End Sub

    Private Sub cbOrderNum_SelectedIndexChanged
    'if selection has been made
    If cbOrderNum.SelectedIndex <> -1 Then

    'enable buttons
    btnPrevOrder.Enabled = True
    btnNextOrder.Enabled = True
    btnPrevProd.Enabled = True
    btnNextProd.Enabled = True

    'fill the dataset
    daOrderDetails.SelectCommand.Parameters("OrderID").Value = cbOrderNum.SelectedValue 'daProducts.Fill(dsProductOrderDetails)
    'daOrderDetails.Fill(dsProductOrderDetails)
    daOrders.Fill(dsProductOrderDetails)

  2. #2
    Join Date
    Jan 2006
    Posts
    67
    I resolved the problem (with the help of a friend). I was calling something that wasn't in the query.

Similar Threads

  1. Form Maintaining Focus
    By brianb13 in forum .NET
    Replies: 1
    Last Post: 03-16-2005, 09:21 AM
  2. Accessing an Access 2000 form using a VB program
    By C. Gonzales in forum VB Classic
    Replies: 1
    Last Post: 01-01-2002, 07:53 AM
  3. Replies: 0
    Last Post: 12-16-2001, 10:11 PM
  4. UPDATING FIELDS OF AN ACCESS 2000 DB
    By ZARVAL in forum VB Classic
    Replies: 0
    Last Post: 04-18-2000, 11:08 PM
  5. Data Form Wizard (ADO) and Access 9.0
    By Dennis in forum VB Classic
    Replies: 0
    Last Post: 03-16-2000, 03:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center