View Full Version : Using Table data in Criteria of Query


Maleko
11-05-2007, 01:58 AM
Hi

I am trying to set up a number of queries to return completed jobs with a specified time frame, usually monthly. So rather than have to type the same dates in arround 20 times I tried to use the data from a table in the Criteria. This did not work any suggestion would be much appreciated.

Attached is a screen shot showing a fragment of the query and the dilog box I get when it runs.

Thanks Marcus

Michael J Ross
11-05-2007, 02:45 AM
Use a form to enter the dates on and reference the form in each of the queries.

Add 2 text boxes to a form and in your queries set the criteria (substituting with actual form name and text box names) to:

Between [Forms]![Nameoftheformyoucreated]![Nameoftextboxfromdate] And [Forms]![Nameoftheformyoucreated]![Nameoftextboxtodate]

The form will need to remain open when the queries run, you can run the queris from a command button on the form.

Maleko
11-05-2007, 03:07 AM
Thanks Michael,

Your solution worked a treat.

Regards Marcus

Michael J Ross
11-05-2007, 03:08 AM
Great glad to help.