Merging queries

chemlab

New member
Local time
Yesterday, 20:53
Joined
Oct 11, 2010
Messages
3
I am building an accounting package for work, which pulls from a database and makes a local table. I then composed 15 queries (ultimately), which contain the summaries (counts of lab tests performed) for my monthly report. The queries cover 5 client types, times 3 billing levels (normal, expedite, rush). Ergo, 15 summary queries. Each query counts the number of tests performed in about 25 service billing groups. The 25 field names are the same in each query.

So far, all queries are working perfectly.

What I want to achieve is to make each of the queries into a record in a table. I have created an index field as the first field in each of the queries and have assigned numbers 1 to 15 to the queries, in the order I desire to position the records in the table.

But now I'm stuck. I need to pull all of these queries together to form one table, from which I may export my 15x25 Excel spreadsheet.

How do I merge these 15 queries into one table?

P.S. Naturally, I am a chemist, and only a novice at programming.
 
I can't help but think that you have too many queries... I may be wrong. But you could probably build a query with the group by information that you need. and the count info as well. - Group by Client Type, Group by Billing Levels, Count on the lab test ID maybe? Also you could probably export it right from there, I would think or have a form that you click a button to perform the export, it shouldn't be necessary to create a new table to do what you want.

Edit: Added Attachment as a quick example
 

Attachments

  • Design View.gif
    Design View.gif
    68.7 KB · Views: 106
  • Run time.jpg
    Run time.jpg
    97.5 KB · Views: 110
Last edited:
I can't help but think that you have too many queries... I may be wrong. But you could probably build a query with the group by information that you need. and the count info as well. - Group by Client Type, Group by Billing Levels, Count on the lab test ID maybe? Also you could probably export it right from there, I would think or have a form that you click a button to perform the export, it shouldn't be necessary to create a new table to do what you want.

Edit: Added Attachment as a quick example


After thinking about the problem a bit further, I used the queries in making sub-reports, then assembled the sub-reports in the proper order to form a final report. Then, I exported the report as an Excel spreadsheet. Problem solved.

Thanks.
 
Ok, I am glad you found a solution that worked for you! :D
 
Ok, I am glad you found a solution that worked for you! :D

I finally talked with my brother, who is a professional db developer. He recommended setting up a macro to perform a sequence of operations, which would use the first query as a make table query and then use each of the remaining 14 queries as append queries. Then, finally, have the macro export the table as an Excel spreadsheet.

Doh! I should have figured that out!

I like my brother's idea better, but both methods work.

BTW, I've experienced a month of aggravating development work, because the developers of the $500,000 database didn't use normalized databases with declared data types. Everything is text, and empty cells are neither empty nor null, but they have Len() = 0. Arrggggh!

Naturally, the database developers want major bucks for further development. Last year's development project was quoted at $155,000. So, I am doing the work for free.
 

Users who are viewing this thread

Back
Top Bottom