Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Posts
    13

    Unanswered: Combox !! 2nd Combo Box

    I have 2 combo box
    First combo box select from a table call year
    and the 2nd combo box row source like
    SELECT [Maker].[Maker] FROM [Maker] WHERE ((Maker.Year)=[Forms]![frmSearch]![Year]);

    But After I select the first combo box value, 2nd Combo box is blank!!

    I make a query from this code, and it work!! If I click the query, I will pop up a
    window when I enter the value I will show the correct Maker under Year it make.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    In the afterupdate of the 1st combobox:
    Forms!frmSearch!MyOtherCombobox.requery
    or
    Forms!frmSearch!MyOtherCombobox.rowsource = "Select Maker From Maker where [Year]= " & Forms!frmSearch![Year] & ""

    Be careful on using the wording Year though. You may want to change this field name to something like CarYear (or something other than Year.) Year is a keyword Access uses and can give you problems. I would highly recommend renaming any tables/fields you have called Year.
    Last edited by pkstormy; 01-25-08 at 18:09.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jan 2008
    Posts
    13
    This is What I put under AfterUpdate, but 2nd combo box still not working.

    Private Sub CarYear_AfterUpdate()
    Me.Maker.RowSource = "SELECT Maker FROM" & _
    " Maker WHERE CarYear = " & Me.CarYear & _
    " ORDER BY Maker"
    Me.Maker = Me.Maker.ItemData(0)
    End Sub
    Last edited by kidrobot2k4; 01-25-08 at 20:28.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I'll see if I can come up with a quick example.
    Last edited by pkstormy; 01-25-08 at 22:08.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    See this example. Hope it helps.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Jan 2008
    Posts
    13
    Finally I make it work...
    But one little question
    When I click the Year
    it will pop up an "Enter Value Window " Why ?
    Shouldn't it input the value I select in Year box ?

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    did you look at the example I created for you?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •