View Full Version : combine all queries into 1


kiaki
04-21-2008, 04:11 PM
Hi~! I'm new in access vba and sql... hopefully my question won't be too dumb.

Basically i'm working on a report... which the report data/information was calculated in few different queries(which i created) from few different tables. in simple, each of the data/information was from a query... i got about 10+ data/information to display, that's why i created 10+ queries.

I done all the calculation in queries, but my problem is... how to add all these queries into 1, so i can directly create a report from the 1 query.

most of the queries was using union all/union... i tried to use union/union all to put all these queries together, but it won't works... because each of the queries using different tables/fields... even though i add those table/fields into the queries... it didn't work as well...

namliam
04-21-2008, 11:54 PM
You can just make one report from multiple queries... Just make one report for each query and then make one "master" report to display all the "sub" reports.

neileg
04-22-2008, 12:26 AM
Extensive use of union queries usually indicates a poor design. If you have similar data in different tables you should probably merge the tables into one.

kiaki
04-22-2008, 03:53 PM
thanks namliam and neileg.

Basically i also tried to use a lot of sub reports and combine together, but the data will be messed up... because all the data is inter-related based on a single id.

for example, id1 will display,
lgA, lgB, lgC, ndtA, ndtB, ndtC, repairA, repairB, repairC, percentageA, percentageB and percentageC

if i create 13 sub reports into a main report, those id that's don't have data in repairA or other field will not be show out... because they will show out those with records only. which most probably they will take id2 repairA data for id1

am i right? sorry if i'm wrong...

actually combining all the tables into 1 is a lot easier, but due to certain reason, i can't do that... that's the problem...

anyway, really would like to thanks again for yours replied. hopefully can have a solution for this problem...

actually i ever tried to combine each 3 queries into 1 query... then combine the combined 4 queries into 1 again... i'm not sure i did anything wrong while combining or what, but the data appear differently. anyway, i still trying my best to solve this... hope can get more replies in here...

namliam
04-22-2008, 10:06 PM
You can link the sub reports to the master... Yes obviously if there is no data for some ID on some subreport, no data will show. But that isnt a problem is it?? No data = nothing to show...