Combo Box for query parameters

Stacey

Registered User.
Local time
Today, 18:24
Joined
Sep 10, 2002
Messages
84
I found quite a few subjects in the forum dealing with this question, but I need even more basic instruction on this.

I have a list of 40 names that I want to be available in a combo box on a form, then the name that is picked be the criteria for a query that will produce a report. I have no idea how to get the name picked in the combo box to be the query criteria. I normally use a macro for things I want to happen. I have used basic VB but I think this is beyond me, and could really use some help.

Thanks
Stacey
 
In the query that feeds the report, set the criteria for the field that you want to filter (it will likely be an ID field) on to

=Forms!NameofYourForm!NameofYourCombo (assuming that the combo columns are ID;Name)

and this will filter the report accordingly.
 
Thank you so much!
 
Hello. I have been struggling with the same problem and your answer got me closer to what I want. Thanks very much. When you use the Combo box to select your criteria, do you have to specify which column in the "Master" table contains the criteria entry? If so, how is that done? On the details of the Combo Box?
 
If you need to refer to a column in the combo other than the first column use;
Code:
Forms!YourFormName!YourComboName.Column([B][COLOR="Red"]x[/COLOR][/B])

Where x represents the number of the column that holds the data you wish to use as criteria. Remember; that the columns in a Combo (or a list box for that matter) are numbered from zero on up.
 
Many thanks indeed. That was exactly where I went wrong - when I matched the proper columns, the correct answers popped up. This will be very useful for what I am doing.

I also found that the combo form was replacing previously valid data (Text) with data from the first column (Numeric) so that explains why, thanks to you.
 

Users who are viewing this thread

Back
Top Bottom