View Full Version : Passing form parameters to query and returning results back to form


teknogeek9
02-05-2001, 09:22 AM
I am really green with this so bear with me, please.
I have been charged with creating a form for which a user inputs values into 4 fields. The user will then receive back values of 5 fields based on the input. I have designed a query for this purpose. How can one use the 4 input fields as criteria for the query with the results coming back on the other side of the form?
Thanks in advance.

Rich
02-05-2001, 02:48 PM
Base the form on the query.

teknogeek9
02-06-2001, 12:59 AM
Gee thanks Rich...thats a great big help!

Chris RR
02-06-2001, 07:40 AM
In your query, click in the "Criteria" for the first field that you'll be checking for a value. Then click on the little magic wand button up on the tool bar, which should take you to the "expression builder".

In the box on the lower left of the "expression builder", you should see "forms" and click on it. Scroll down until you find the name of the form that the user will be using to enter criteria. Click on it. Scroll down the middle section of the "expression builder" until you find the exact field that the user will be entering. Click on that. It should then appear in the box on the top of the "expression builder". If the user will ALWAYS put something in that field, you can just click on "OK". (Otherwise, look up "LIKE" in the help screens...)

That's how you put a form field into a query's criteria. You'll have to do it for each of your four fields. If you run the query with the form open (even if it is minimized), the query will put it's criteria from the form. If you do NOT have the form open, Access prompts you for the values.

OK, if you've done this right, you can run the query and get just the data you are looking for. There are many ways of displaying this, which I leave you to ponder.

Rich
02-06-2001, 08:49 AM
Assuming your response was a sarcastic one, a simple I don't understand would have been more in keeping with the spirit of this forum. The answer is that instead of using the table as the form's record source you use the query.
Delete your original form, select auto form columnar, etc.or use the form wizard to create a new form using the query as the record source for the form.
HTH