Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 query's into 1 report

Status
Not open for further replies.

l3reacher

Technical User
Jun 28, 2003
83
US
Hi, I have this problem but couldn't solve it. I have a report called rptNames, and 2 query(called qrynameAL/qrynameMZ). Under qrynameAL I have a column name called "age", and on the qrynameMZ i have a column called "grades". My question is how would I be able to use both of those query's within 1 report. I only know how to use one of those qry into 1 report, but not 2 in 1 report. Pleaze help, thanks!!

I Hate Spammers and Flammers!!!
 
O yeah!! I forgot to say that this is not under a network but locally..

I Hate Spammers and Flammers!!!
 
It might be easier to answer if I knew the context.

Any way, can you write a query that pulls both of your queries into one dataset?
 
It depends on what you want to do. If you want to make a single recordset then create a union query and base your report on this. Alternatively, if you have records in qrynameMZ that are related to records in qrynameAL then you need to make a query with a join between the field that is common between the two queries.
From your question it seems that the union query is the way you are heading.

Sample syntax:

Select YourField1,YourField2,YourField3
from Yourtable1
union all
Select YourField1,YourField2,YourField3
from Yourtable2

the fields in the statement must be identically named.

HTH,
Eric
 
Thanks for replying..
both of the query's are not related to each other. Each of those has it's own unique information.

I Hate Spammers and Flammers!!!
 
If the queries aren't related, you can create new, blank report and add two (or more) reports to the main report as subreports. Keep in mind that subreports ignore all page sections and events.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
I did create a new report, but how would I be able to use 2 query's into 1 report. I have one textbox called Student's Name, which the information needs to come from qryNameAL- field name is called "Name". The other textbox is called Teacher's age, in which the information needs to come from qryNameMZ - field name is called "age"? I tried using luceze's statement, but it doesn't work in VB, only in SQL view. I hope this makes my question clearly.

I Hate Spammers and Flammers!!!
 
Create a report based on qryNameAL and a report based on qryNameMZ. Drop both reports onto either an existing or a new report. This makes your two new reports into subreports.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top