Displaying queries in forms

Gillian

New member
Local time
Today, 11:01
Joined
Mar 12, 2002
Messages
6
Bear with me as i try to explain what i need to do.

Ok what i am trying to do is display a saved query as a form. This will then allow my user to enter the input for the query into a form making the whole process nice and easy for them. I only want to search across a few fields in a table when i used the form wizard to put the query on the form it kept telling me that the "Module can not be found".

I have little experience with access, therefor please keep explanations sweet and simple!

Any help would be greatly appreciated!
 
1. You need to create an unbound form with the fields on it that you need/want your user to be able to search by.

2. In your query, you need to limit the results of your searchable fields by referencing the fields on the unbound form you just created. For the condition of the query field, you would add the following for each searchable form field:

for an exact match:

= Forms![Formname]![fieldname]

or to do a "partial match" search:

Like "*" & Forms![Formname]![fieldname] & "*"

replace Formname and fieldname with the appropriate values...

3. Once you've set up the Query, add a command button to the form, from the wizard you can select the "Run Query" action under the "Miscellaneous" section (or if you create a report or form from the query you can use the open report/form command, etc.).

4. Open the form, enter your search criteria, and click the button to run the query. The query will pull its limits from the unbound form & display whatever results it finds...

This is a very basic way of doing things, you may want to add some advanced features to this down the road as you get familiar...

good luck!
 
I think what you're asking is to build a search form.
Create a new Form, but don't tie it to any source. Create enough fields in it for each of the parameters you want to search by.
I have an example code if you're just going to be searching by any one of those fields at once. Post back and I'll put it up.
If you're going to be doing all fields at once, look at this topic about building a dynamic SQL statement: http://www.access-programmers.co.uk/ubb/Forum4/HTML/000850.html
Another option is Query by Form. Check here: http://www.access-programmers.co.uk/ubb/Forum1/HTML/000096.html

I'm not quite clear on your aim, so hopefully one of these ideas will get you closer to the mark. If not, post back with more information and perhaps someone will run with it.

Good luck,
David R
 
I just want to be able to search across one field at a time. A code would be greatly appreciated!

Thanks!
 

Users who are viewing this thread

Back
Top Bottom