Transferring data (1 Viewer)

Ramshan

Registered User.
Local time
Today, 08:05
Joined
Aug 17, 2011
Messages
48
Hi everyone,
I need to transfer data from many sub tables to one big table by writing a macro( or let me know if there is any other option). I have no knowledge in macros, please help.

Example:
Main table - Table 1(Contains columns named a,b,c,d,e)
Sub-tables table 2(contains columns a,c,d), and table 3 (contains columns a,d,e).

In this case how I will write a Macro to transfer the data from sub-tables to main tables?

Thank you!
 

DavidAtWork

Registered User.
Local time
Today, 16:05
Joined
Oct 25, 2011
Messages
699
You can create several queries to append all records to a shell (or main) table. If you want fresh data each time you'll need to empty the shell table, then run query 1 that will append data from Table 1, then query 2 to append data from Table 2 etc.
Once you have created all the queries you need, create a macro which will call all the necessary queries.
David
 

Ramshan

Registered User.
Local time
Today, 08:05
Joined
Aug 17, 2011
Messages
48
Thanks for the reply David.
I have one more question, is that possible for me to do the append queries and macros, if my sub tables are located in different database file?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:05
Joined
Feb 19, 2002
Messages
43,515
If your tables are not local, you can link to them in the other databases and work with them that way. If this is a one time effort, creating a macro to run all the append queries in sequence is OK. I personally never use macros and I would suggest that you bite the bullet and learn a little VBA. You can start by writing the macro and then using the built in tool to convert it to VBA. Then you'll see how easy the code is. Aside from the error trapping code, it takes only a single VBA statement to run a query so this is actually very simple code for a beginner. There are no If statements or looping logic. Just do this, this, this, etc.
 

Users who are viewing this thread

Top Bottom