Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    Japan/California
    Posts
    68

    Question Unanswered: populating a second combobox

    hello,
    i have 2 combo boxes, i want to filter the secod based on the selection made in the first. for some reason a popup comes up asking me for a paramater, and if i type it in then it works.
    any ideas on how to do this automatically? the popup really defeats the purpose of the first combo box
    heres the code:

    Private Sub combo1_AfterUpdate()
    Me.combo2.RowSource = "SELECT city FROM destination WHERE region = " & Me.combo1
    End Sub

    thanks in advance,
    Jonah

  2. #2
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    Change it to

    Dim var1
    var1 = "SELECT [Table].[FieldCombo2] FROM Table WHERE [Table].[FieldCombo1] = '" & Me.Combo1 & "'"
    Me.Combo2.RowSource = var1

    Careful with " and '

    Cheers
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  3. #3
    Join Date
    Jul 2003
    Location
    Japan/California
    Posts
    68

    Talking &

    and you were right, i fixed the & and everything worked fine,
    thanks a bunch

    Jonah

Posting Permissions

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