multiple queries in Access 2003 Reports

J

Joanne

Is it possible to base a report on more than one query?
I have two text boxes, each based on a different query. I just used the
properties value of the text box and then the control source to put in the
two different queries. The first text box has the following:
=[Class6] & [Class5] & [Class4] & [Class3] & [Class2]
This text box is based on qryBreakdownOfClasses and works fine.

The second query has the following:
=[qryRequiredFootnotesClass]![Class1] and prompts me for a parameter value
when I run the report. If I run this query by itself it runs fine so I'm
assuming I've done something wrong in the report and I'm guessing it's that
you can't have two separate queries in one report. If I can't do that could
there possibly be a workaround? Thanks in advance for any help.
 
T

tina

=[qryRequiredFootnotesClass]![Class1]

you can't reference a query object that way.
a report (like a form) can only have one RecordSource. if you can "combine"
the fields from the two queries into a third query, and base your report on
the third query, that would do it - but it may not be possible. another
option to get the [Class1] value from qryRequiredFootnotesClass would be to
use a DLookup() function in the textbox control, as

=DLookUp("[Class1]", "qryRequiredFootnotesClass")

note that if this control is in the detail section of the query, then the
function will run for each record, which may slow down the report
considerably.

hth
 
J

Joanne

Thank you very much. The DLookup worked.

tina said:
=[qryRequiredFootnotesClass]![Class1]

you can't reference a query object that way.
a report (like a form) can only have one RecordSource. if you can "combine"
the fields from the two queries into a third query, and base your report on
the third query, that would do it - but it may not be possible. another
option to get the [Class1] value from qryRequiredFootnotesClass would be to
use a DLookup() function in the textbox control, as

=DLookUp("[Class1]", "qryRequiredFootnotesClass")

note that if this control is in the detail section of the query, then the
function will run for each record, which may slow down the report
considerably.

hth


Joanne said:
Is it possible to base a report on more than one query?
I have two text boxes, each based on a different query. I just used the
properties value of the text box and then the control source to put in the
two different queries. The first text box has the following:
=[Class6] & [Class5] & [Class4] & [Class3] & [Class2]
This text box is based on qryBreakdownOfClasses and works fine.

The second query has the following:
=[qryRequiredFootnotesClass]![Class1] and prompts me for a parameter value
when I run the report. If I run this query by itself it runs fine so I'm
assuming I've done something wrong in the report and I'm guessing it's that
you can't have two separate queries in one report. If I can't do that could
there possibly be a workaround? Thanks in advance for any help.
 
T

tina

you're welcome :)


Joanne said:
Thank you very much. The DLookup worked.

tina said:
=[qryRequiredFootnotesClass]![Class1]

you can't reference a query object that way.
a report (like a form) can only have one RecordSource. if you can "combine"
the fields from the two queries into a third query, and base your report on
the third query, that would do it - but it may not be possible. another
option to get the [Class1] value from qryRequiredFootnotesClass would be to
use a DLookup() function in the textbox control, as

=DLookUp("[Class1]", "qryRequiredFootnotesClass")

note that if this control is in the detail section of the query, then the
function will run for each record, which may slow down the report
considerably.

hth


Joanne said:
Is it possible to base a report on more than one query?
I have two text boxes, each based on a different query. I just used the
properties value of the text box and then the control source to put in the
two different queries. The first text box has the following:
=[Class6] & [Class5] & [Class4] & [Class3] & [Class2]
This text box is based on qryBreakdownOfClasses and works fine.

The second query has the following:
=[qryRequiredFootnotesClass]![Class1] and prompts me for a parameter value
when I run the report. If I run this query by itself it runs fine so I'm
assuming I've done something wrong in the report and I'm guessing it's that
you can't have two separate queries in one report. If I can't do that could
there possibly be a workaround? Thanks in advance for any help.
 
Top