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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying the entire data from a range of tables into one

Status
Not open for further replies.

PeteCan

Programmer
Jan 15, 2002
60
GB
Can anyone help:

I have over 1000 tables called ILCommentx (where x=1 to 1000+). I want to copy the entire contents of each table into one table called ILComments.
I could do this manually but as I'm sure you'll appreciate this would take a considerable amount of time, has anyone any idea how I can setup a macro to automatically do this?
 
Take a backup first:
Create a sub as follows.

dim x as integer
for x = 1 to 1000
strsql = "Insert into ilcomments Select * from Ilcomments" & x
currentdb.execute strsql, dbfailonerror

next x
 
This gonna sound really thick but how do I do this in Access?

I've created a module called test with the above code in it,
then how do I run it?

thanks
 
With the cursor inside this sub, press F5

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks, it does the first table,just gotta get it to do the rest now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top