Monday, March 19, 2012

How to set two or more queries in one report

I'm having a problem with accessing two or more data sources and display in a single report(same paper). I'm using CR XI Dev. Ed. and VB 6.0 sp6

For example:

I have a table named 'Patients' and the fields are,

Name, Date_Admitted, Date_Discharged

The first sql query is

Select * from Patients Where Date_Admitted = 'Date'

then the second query is

Select * from Patients Where Name = 'James'

How will I display this two diffrent sql queries in a single report(same paper)?

Please! anyone! help me!!!See reply in other forum.|||Thanks for the reply! But I have another question if it's ok with you?

I managed to add a sub report on my main report, but how do I make it appear this way?

Example:

The given first sql query is

"Select * from Patients Where Date_Admitted = 'Date'"

Then display all the data in the first statement first

[Name][Date Admitted][Date_Discharged]

[Jay][8/15/2006][8/16/2006]
[John][8/15/2006][8/16/2006]
[Bob][8/15/2006][8/16/2006]

Then execute the second query

"Select * from Patients Where Name = 'James'"

Then display all the data in the second statement

[Name][Date Admitted] [Date_Discharged]

[James][8/9/2006][8/10/2006]
[James][8/6/2006][8/7/2006]
[James][8/10/2006][8/12/2006]

Then the final output would be like this

[Name][Date Admitted][Date_Discharged]

[Jay][8/15/2006][8/16/2006]
[John][8/15/2006][8/16/2006]
[Bob][8/15/2006][8/16/2006]

[Name][Date Admitted] [Date_Discharged]

[James][8/9/2006][8/10/2006]
[James][8/6/2006][8/7/2006]
[James][8/10/2006][8/12/2006]

No comments:

Post a Comment