View Full Version : parameter from drop down list


wboender
11-19-2001, 06:07 AM
Is there a way to make a parameter with a query that may be picked from a drop down list?

jwindon
11-19-2001, 10:08 AM
Yes. Refer to two or more unbound text box controls on an unbound form in your query criteria.

jwindon
11-19-2001, 01:33 PM
After reading this again..I thought perhaps I may have read your post wrong. If you wish to choose a query name from the list, you will need to have values assigned to your selection and then run code of If-Then against that value to determine the action (the query to run).

Jack Cowley
11-19-2001, 01:49 PM
And I read it differently than that.... If your combo box has the criteria for your query then refer to your combo box like this in the Criteria line of you query:

[Forms]![FormName]![ComboBoxName]

Be sure the criteia in the combo box are the bound column.

wboender
11-20-2001, 01:23 AM
Dear helpers,

I am very sorry for the ambiguity in my text. The question is: given is a query; and the possibility to enter a parameter value via the form you get after specifying it in the criteria line. How can I make a parameter value form where the user should select from a (database) list of field values (as in a combo box or compare it to a look up field)?

I tried Jack's solution, but to no avail: now I get the one value parameter form on starting the query and it has the title [forms]![my formname]![my combobox name]

Fizzio
11-20-2001, 01:32 AM
You must make sure that the form is open before running the query and that the criteria is precise - No typos ;-).
You can set the combo box to run the query by putting in the After_Update() event of the combo box

Sub YourComboBoxName_AfterUpdate()
DoCmd.OpenQuery "NameOfYourQuery", acViewNormal, acEdit
EndSub

wboender
11-22-2001, 05:46 AM
Thanks, that is as close as I can get.