Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

Hi Charles,

Usually when the item isn’t displaying in the dropdown it has to do with either the display properties of the combo box or the value attached to the combo box is not a value in the row source.

A couple of things to check:

1. The display columns property.  Make sure it’s set to at least 2, 1 column for the EngID and one column for the last name.
2. The column widths property.  This is just a text string seperated by semicolons (;) and specified in inches wide.  You can type 0;1 which will hide the first column and show the second (the last name in the Engineer filter case with a width of 1 inch.
3. Double check that the Bound column property is set to 1 for the first column.

Ok, I looked into the actual issue and it looks like after the first combo box selection, the rowsource of the filter is getting reset and is no longer displaying any records.

In the case of the db you attached, it is because you are setting the rowsource incorrectly when it gets focus and the FilterStr exists:

Code: [Select]

Me.EngFilt.RowSource = "SELECT DISTINCT [Engineers].[EngID], [Engineers].[LastName], [Engineers].[FirstName] FROM Engineers ORDER BY [LastName] WHERE FiltStr;"
That line should be this:

Code: [Select]

Me.EngFilt.RowSource = "SELECT DISTINCT [Engineers].[EngID], [Engineers].[LastName], [Engineers].[FirstName] FROM Engineers ORDER BY [LastName] WHERE " & FiltStr & ";"
Although you have probably changed it since then to use my new code above.  Basically, the FiltStr is a variable you have to use to build the RowSource, which you have to do by closing the string literal with a quote, appending the FiltStr variable with ampersands (&) and then adding your optional semicolon at the end in quotes.

Review the above two lines of code and that should help you rebuild your exisitng line of code to be correct.