Pulling Query Criteria From Forms

sbf2014

Registered User.
Local time
Today, 13:40
Joined
Mar 28, 2014
Messages
17
Hi everyone,

I may be out of my depth on this issue, but I thought it was worth bringing to the forum anyway. Let's see if I can explain myself clearly...

I have several (about 10-15) queries that I have designed to run monthly reports. Various pieces of the criteria for each query need to change regularly. My boss wants to keep other people from editing the queries, so I have been asked to create a form that will set the criteria for each query.

For example, in design view, I currently have a 'Where' field for each of our eight products. Where 1= include the product in the query analysis. Where 0= do not include the product in the query analysis. We would like to have a form that has entry boxes for each product where the person doing the analysis could type '1' or '0' and then the query could update the criteria entered before running.

We also need dates to update via the form. I currently have [Current Period End Date] and [Prior Period End Date] pop up boxes on each query that allow the person running them to enter their desired dates. But again, my boss wants to limit their involvement with the actual queries. Plus, you end up entering the dates for all 10-15 queries, which is a hassle. We would like to have entry boxes for the desired dates in the form and have the queries pull date criteria from the form.

If we can pull query criteria directly from a form, is it possible to create a table from a form and then pull the query criteria from the table?

Fyi, I am limited SQL knowledge and have never used VBA in Access.

Thanks in advance for any input!
 
You reference the controls on a form by

Forms!formname!controlname

The form must remain open, I run queries and reports from a command button on the form. I keep the control names short with no spaces but maybe underscores eg end_date and give more detail in the label.

Brian
 
Thank you! That has helped a lot!
 

Users who are viewing this thread

Back
Top Bottom