SEVERAL QUERIES - SAME PROMPT

O

okschlaps

I have an Access front-end database set up just to pull information from a
variety of sources. The queries are set up to prompt for start dates and end
dates. Is there a way to enter the prompts once for all of the queries. for
instance, can I put a prompt in VBA code as a variable and run the queries
with a do command?
thanks.
 
F

fredg

I have an Access front-end database set up just to pull information from a
variety of sources. The queries are set up to prompt for start dates and end
dates. Is there a way to enter the prompts once for all of the queries. for
instance, can I put a prompt in VBA code as a variable and run the queries
with a do command?
thanks.

Add a new unbound form to the database.
Add 2 unbound controls.
Set their Format property to any valid date format.
Name one "StartDate" the other "EndDate"

Add a command button to the form.
Code it's click event:
Me.Visible = False

In each query, on it's DateField's criteria row, write:

Between Forms!FormName!StartDate and Forms!FormName!EndDate

Open the form and enter the 2 dates. Click the command button. The
form will hide.
As long as this form is open (even though not visible), any query that
references the controls on the form will use those dates as criteria.

Remember to close the form when you are through with the queries, (or
at the end of the day, or whenever).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top