Results 1 to 3 of 3
  1. #1
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Multiple Control Box on Page

    I have two combo boxes on my form. The first is the custid field in the customer table. Once the user selects a custid field they are taken to the vehicle combo box. I want to narrow down the data in the vehicle combox box based upon the customer retieved from the custid combo box. Right now it works the first time, but it keeps repeating the vehicle info from the first.

    On the custid I have the following:
    SELECT Customer.Custid, Customer.[Last Name], Customer.[First Name]
    FROM Customer
    ORDER BY Customer.[Last Name], Customer.[First Name];

    AfterUpdate Event:


    Private Sub LastName_AfterUpdate()
    FirstName = DLookup("[First Name ]", "Customer", "[CustID ] = " & Me!Custid)
    City = DLookup("[City ]", "Customer", "[CustID ] = " & Me!Custid)
    State = DLookup("[State ]", "Customer", "[CustID ] = " & Me!Custid)
    Zip = DLookup("[Zip Code ]", "Customer", "[CustID ] = " & Me!Custid)
    Me!SelectTag = vbNullString
    Forms!SelectInvoice!SelectTag.SetFocus
    End Sub

    The select statement for the SelectTag is:
    SELECT Vehicle.Tag, Vehicle.Year, Vehicle.Manufacture, Vehicle.CarType, Vehicle.Custid
    FROM Vehicle
    WHERE (((Vehicle.Custid)=[Forms]![SelectInvoice]![Custid]))
    ORDER BY Vehicle.Year, Vehicle.Manufacture, Vehicle.CarType;

    Thanks a ton!

  2. #2
    aquaraider is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2009
    Posts
    14
    Try put your2ndcombobox.Requery in your 1st combobox
    eg, put
    Forms!SelectInvoice!SelectTag.Requery
    before Forms!SelectInvoice!SelectTag.SetFocus in your afterupdate event

    2nd combobox needs a requery when 1st combobox changes so that changes will be made.

  3. #3
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Smile Thank you it worked like a charm.

    Thanks Again!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-12-2009, 09:55 AM
  2. Replies: 0
    Last Post: 02-11-2009, 06:43 PM
  3. Sending control to specific control
    By wasim_sono in forum Programming
    Replies: 2
    Last Post: 04-19-2007, 08:19 AM
  4. Multiple Subreports with page break
    By rayc in forum Reports
    Replies: 7
    Last Post: 09-02-2006, 06:59 PM
  5. Page Footer Top
    By RHall in forum Reports
    Replies: 3
    Last Post: 12-15-2005, 09:35 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
  •  
Other Forums: Microsoft Office Forums