Query By Form?

Dano

Registered User.
Local time
Today, 00:47
Joined
Jul 16, 2004
Messages
20
Can anyone give me tips on creating a form with a text box that will populate the criteria field in a query and have it run upon submit and display the results in a table?
 
I suggest checking out the Access Cookbook published by O'Reilly from a local library. I found the solution to creating procedure queries by form in chapter 1.2, which was a continuation of chapter 1.1.

You need to define the Field criteria at be Forms![FormName]![ControlName]. That will make the query run forcing the Field equal to the value of the form control, in this case ControlName.

To run the query, put a button on the form with the following code behind the click event.

Private Sub cmdOK_Click()
docmd.openQuery "QueryName"
End Sub

This should be the key to form based parameter queries, but I suggest you read through the first two sections of the Access Cookbook for a more detailed explaination on the parameter query creation.

Joe
 
Make your textbox in the form unbound, then in the Query where you need to put the criteria, place the following: [Forms]![Formname]![TextboxName]
 
Got it guys!

Thanks...It's been a while
 

Users who are viewing this thread

Back
Top Bottom