Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010

    Unanswered: Populating a combo box based on selection from another combo box

    Hi ,

    I am trying to design a form.

    I have a table name called Flight Details

    Flight Destination Flight Number
    ABC-XYZ 211
    ABC-XYZ 221
    DEF-GHI 121

    I have created a form which has a combo box that displays all the flight detinations.

    I want to create another combo box which only lists down flight numbers which match the user selected flight destination. So for example if the user selects ABC-XYZ, then flight 211 and 221 should be displayed in the other combo box.

    How can I do this?

    Thanks a lot for your help.

    Best regards,

    Uzair Moosa

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    The concept is called "cascading comboboxes" and if you search here or using Google you should get about a gazillion hits! Here's one tutorial on the subject:

    Cascading Combo/List Boxes - Microsoft Access / VBA insights
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Mar 2010
    Thanks a lot for this pointer.

    I have gone through the link that you sent and also a couple of other websites.

    I am doing exactly what is required by the website but I am not getting the desired results.

    I have two combo boxes LegPair and Flight. When user selects value from LegPair the flight combo box should be populated.

    So I am writing the following code in the AfterUpdate event in LegPair combo box:

    Flight.RowSource = "SELECT [tblRoute-flights].flight " & _
    "FROM [tblRoute-flights] " & _
    "WHERE [tblRoute-flights].LegPair = '" & LegPair.Value & "' ;"

    This line of code instead of resulting me the query result simply displays this string in the combo box. So the Flight Combo box just displays this

    SELECT [tblRoute-flights].flight
    FROM [tblRoute-flights]
    WHERE [tblRoute-flights].LegPair = LegPair.Value

    The LegPair.Value shows the value that I selected in LegPair combo box.

    Any ideas of how do I get the query result instead of a string with the SQL statement.

    Thanks a lot.

  4. #4
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 18
    Use your SQL statement as the record source for the Flight combo box?
    10% of magic is knowing something that no-one else does. The rest is misdirection.
    Beers earned: 2

Posting Permissions

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