View Full Version : Set up a query to get criteria from a popup dialog


joshosu420ok
05-13-2002, 06:05 PM
How do I set up my query to get its criteria from a form or dialog box that pops up when I run the query.

llkhoutx
05-13-2002, 07:08 PM
The criteria in your query is the contents of the dialog box. Use the expression builder to properly buiild the reference to the dialog box.

joshosu420ok
05-13-2002, 08:01 PM
What do I put in the criteria field to make the form popup when I run the query?

rich.barry
05-13-2002, 10:48 PM
The dialog box should run the query, not vice versa.
Set up a form containing all your criteria entry boxes, combos etc, plus a run query command button.
The On_Click event code of the button should be :

DoCmd.OpenQuery "QueryName", acViewNormal
DoCmd.Close acForm, "DialogFormName"

While the form is open, open the query as well, then go into the Builder. Under Forms, Loaded Forms you will find all the controls on your Dialog Form, thus you can make the query get the values from the form when the query runs.