Yes. Put a textbox (call it txtValue) and a command button (call it
cmdQuery) on your form (call it frmShowResults). Let the user type the
desired value into the textbox. Then the user would click the command button
to run the query. You'll need to decide what to do with the results of the
query, of course.
Let's assume that you want to show the results of the query in this form.
Put the textbox and command button in the form's header section. Open the
Properties window from the toolbar. Set the form to continuous forms view.
Set the form's Record Source to the query that we'll run. Put controls in
the Detail section of the form that are bound to the different fields in the
Record Source.
While your form is in the design view, change to the command button in the
Properties window. Click Event tab, and then click in the box next to On
Click. Then click on the "..." button at far right of that box. Select "Code
Builder" in the popup window that shows, and then you'll see the Visual
Basic Editor opened, with three lines showing on the screen (cursor will be
on the second, blank line):
Private Sub cmdQuery_Click()
End Sub
In the blank line, type this:
Me.Requery
Close the Visual Basic Editor. Save and close your form.
Then open your form. Type a value in the textbox, and then click the command
button. The form should show all the records from your query that match the
value you typed in the textbox.
--
Ken Snell
<MS ACCESS MVP>
Go to your query and open it in design view. In the "Criteria:" cell under
the desired field that will be the value in the textbox, type this
expression:
[Forms]![frmShowResults]![txtValue]
Save and close the query.