Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58

    Unanswered: Update combo box based on the selection of another combo box.

    I have two tables:

    Make
    make_id
    make

    Model
    model_id
    make_id
    make
    model
    modelname

    I have a combo box named cboMake and cboModel. I want to select the Make and it populates cboModel with all of the models. I have the following code in cboModel source:

    "select model from tblmodel where make_id = " & cbomake.value"

    I get the following error:
    Closing delimiter not found for string beginning at position 60 in the command. The string begins with: " & cbomake.value

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try
    IF cbomake.value is numeric
    "select model from tblmodel where make_id = " & cbomake.value & ";"

    OR if it is string
    "select model from tblmodel where make_id = '" & cbomake.value & "';"

    ??? are we in code, or in properties¦data¦rowsource ???

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    Originally posted by izyrider
    try
    IF cbomake.value is numeric
    "select model from tblmodel where make_id = " & cbomake.value & ";"

    OR if it is string
    "select model from tblmodel where make_id = '" & cbomake.value & "';"

    ??? are we in code, or in properties¦data¦rowsource ???

    izy
    Properties|data|rowsource...

    I am getting invalid column name.

  4. #4
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    Originally posted by izyrider
    try
    IF cbomake.value is numeric
    "select model from tblmodel where make_id = " & cbomake.value & ";"

    OR if it is string
    "select model from tblmodel where make_id = '" & cbomake.value & "';"

    ??? are we in code, or in properties¦data¦rowsource ???

    izy
    Properties|data|rowsource...

    I am getting invalid column name.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You should consider putting that code in the AFterUpdate event of the first combo box.

Posting Permissions

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