Duane's code seems to be letting the query run free and then filtering on the form. I personally would rather apply the parameter to the query. I don't know which is a better way to do things. What I did when I was asked to get rid of the parameters was to create a public variable and a function to read it. Then I set the query criteria equal to the function.
How would you do that?
Go to the module section of the database and click the Modules tab. Click "New". A window will open up ready for you to type code.
Type the following:
Public kyfld as Long
Public function keyfd() as long
keyfd = kyfld
End Function
Actually you won't have to type the last line; it will automatically be generated when you type the Public function line.
What you have done is declare a variable by name (kyfld) and type (long - can handle big integers). I would recomend naming the variable exactly the same as the field in the table to which the criteria will be applied. (At this stage it doesn't really matter, but in complex query gathering forms it can cut the code down substantially and eliminate the need to change code when new criteria are added)
You have also created a function by name (keyfd) and type as you did with the variable. (a procedure that returns a value such as Now() which returns the current date and time)
Now go to the On DoubleClick event for the combo box where you want to select your criteria as I described previously and type:
kyfld = Me.ComboboxName
ComboboxName is whatever the name of the combo box is (see the properties window, "Other" tab. The name is the first line.
Now in the query, in the criteria box in the grid type:
keyfd()
When you click a value in the combo box, the doubleclick event will set the global variable equal to the value you selected.
When the query is run, it will call the function. The function will open and middle line will set the function equal to the global variable and that is what the query will use for its parameter.
Doing it this way really is nice when you have to do this with several criteria (Such as StartDate, EndDate, PriorPeriodStartDate, PriorPeriodEndDate, OfficeNumber) which is what was happening here. It was a parameter query that asked all five questions One - At - A - Time. My boss asked me to do something about it and that's how I did it.