4 Query's in one report (1 Viewer)

durdle17

Registered User.
Local time
Today, 07:14
Joined
Feb 21, 2003
Messages
28
4 Query's in one report

I have a Report graph that is based on 4 querys. These 4 querys prompt the user for the same 3 questions Name, Start Date & End Date. The criteria for the Name field is
Like "*" & [Enter Partial Name] & "*"
and the criteria for the start/end date is
>=[Start Date:] And <=[End Date:].
I was wondering when the user enters the Name, Start&End dates can these answers replicate to the other 3 querys so they don't have to enter the samething 4 times.
Or do anyone know another way around this?

Thanks for any help

Chris
 

llkhoutx

Registered User.
Local time
Today, 01:14
Joined
Feb 26, 2001
Messages
4,018
Store your criteria on a form and have the queries reference the fields on that form.
 

durdle17

Registered User.
Local time
Today, 07:14
Joined
Feb 21, 2003
Messages
28
Thanks llkhoutx
I have my form created with the 3 required fields(Patial Name, Start Date, End Date). Now I am tring to figure out where to store the 3 field names and then "call" the 4 queries. I am thinking a macro, do you have any idea?

Thanks
 

llkhoutx

Registered User.
Local time
Today, 01:14
Joined
Feb 26, 2001
Messages
4,018
If the queries are used as recordsource(s) in a report and its subreports are "run" there, there is no reason to "call" them anywhere. The criteria for the queries is stored on a form and referenced in the query.

Example:

Form "frmOne" has the following fields:

txtPartialName
txtStartDate
txtEnd Date

It also has a button, which "opens" the subject report.

docmd.openreport "rptYourReport"

"rptYourReport" has two subReports:

srptOne
srprTwo

The recordsource for "rptYourReport" is
"Select * FROM tbYourTable where [PartialName]='" & Forms! frmOne!txtPartialName" & "'"
Note the tic marks.

The recordsource for srptOne is:
"sELECT * FROM tbsrptTable WHERE dtDate BETWEEN " _
Forms! frmOne!txtStartDate & " AND " & Forms! frmOne!txtEndDate

The recordsource for srptTwo is similarly constructed.

When rptYourReport is opened the queries will be "run."
 

Users who are viewing this thread

Top Bottom