A Question about the Query: -
Are you specifying your filter criteria in the Query
against the actual field?
If you are not then this is the problem. Open up the Form
and the Query, both in "Design View". For the Query, find
the field, then select the Criteria: Box underneath the
Field.
You then need to create a statement like: -
Like [Forms]![StandardFormsOfInstruction]![SiteNumber]
In the Criteria: -
[Forms] identifies the object is a Form.
[StandardFormsOfInstruction] is the name of the Form.
[SiteNumber] is the name of the Field.
Adjust the names of the objects then save and close the
Query.
For your Command Button on the Form, you will need the
following code: -
Dim QryName As String
QryName = "MyQueryToOpen" 'REPLACE MyQueryToOpen WITH THE
NAME OF YOUR QUERY
DoCmd.Close acQuery, QryName, acSaveNo
DoCmd.OpenQuery, QryName, acViewNormal,acReadOnly
HTH
Tony C.
-----Original Message-----
I have a query that works fine, but I would like to
generalize it so that a form can provide the parameters
for the query. I have put the "Where" criteria in the
query and set the criteria to be the form object (a combo
box). When I open the form, and select the criteria from
the combo box, I click a button to open the query.
However, the query still prompts for the value instead of
reading it from the form.