Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    8

    Unanswered: Cascading Combo Boxes

    Happy Holidays!

    I have a data entry form. The form is based off of a query which show Field Name, Well Name, Well Number.

    I would like to be able to choose a field and for the next combo box to show only the well names for that field. I have looked up cascading combo box and I cannot get it to work. I am having a serious brain fart.

    The combo boxes are bound boxes. The first combo box is Field ID, the second combo box is Well Name. Any help would be greatly appreciated. Thank you.

    Ofelia

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    for the second comboBox use the next code

    comboBox2.RowSource = "SELECT * FROM yourTable WHERE yourField = '" & combBox1 & "';"

  3. #3
    Join Date
    May 2006
    Posts
    8

    Cascading combo boxes

    Where do I put the code? Do I put in the row source for combo2?

  4. #4
    Join Date
    Jul 2006
    Posts
    108
    yes put it in the rowsource

  5. #5
    Join Date
    May 2006
    Posts
    8

    Cascading Combo box - not resolved yet

    I have cboFieldID which is a bound combo box.

    The row source is as follows:

    SELECT [tbl Field].[Field Id], [tbl Field].[Field Name] FROM [tbl Field] ORDER BY [tbl Field].[Field Name];

    Col Count is 2
    Col Width 0;1.8
    Bound Column 1 - I am storing Field ID

    The second combo box is:

    cboWellName
    It is bound to field Well Name

    I would like to be able to choose a field and for the second combo box to filter the Well Name based on the field.

    The form is based on a query:

    SELECT [tblWell Information].[Field ID], [tblWell Information].[Well Name], [tblWell Information].[Well Number], [well name] & ", " & [well number] AS Name
    FROM [tbl Field] INNER JOIN [tblWell Information] ON [tbl Field].[Field Id] = [tblWell Information].[Field ID]
    ORDER BY [well name] & ", " & [well number];

    The suggestions given are great. However, I cannot get it to work.

    I hope I painted a better picture of my problem.

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Put it in the on change of the first ComboBox....

  7. #7
    Join Date
    Feb 2007
    Posts
    17
    ---sorry wrong thread :$

  8. #8
    Join Date
    Jul 2006
    Location
    Tucson, Arizona
    Posts
    19
    You might be having the same problem I did a while back. For the first query, have an autonumber primary key. For the second query, set the foreign key type to number (since the autonumbered primary key in the first query is just a number in the second query). I pulled my hair out for a month before I figured out what I was doing with that thing.

Posting Permissions

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