Copy all data from table1 to table2 in database2

pedie

Registered User.
Local time
Today, 15:16
Joined
Aug 3, 2011
Messages
20
Hi I need help with vba to copy all data from table1 in database1 to table2 in database2. both the tables has same fields...with attachement field too.

Thanks alot in advance for helping...
 
not sure about the attachments, but you coould do this the other way

from database 2, link to the table in database 1, and then do a maketable query to copy it. (or copy everything into a predesiged empty table.)

indeed do you really need to copy it at all? could you not just link to it only?
 
not sure about the attachments, but you coould do this the other way

from database 2, link to the table in database 1, and then do a maketable query to copy it. (or copy everything into a predesiged empty table.)

indeed do you really need to copy it at all? could you not just link to it only?


Linking i think wont be very good just because if users delete data from database1 then data in database2 will also disappear...and database2 is in network drive while database1 is in personal user computer....

"Copy everything into a predesiged empty table" this may work if it can copy the attached files in records too...


Could you please show me one example to complete this with attachment in it?
 
hi lcook1974, i treid the below code from the link and it error...i'm not sure where 'm doing wrong...

"Runtime error 3075"
Syntex error (missing operator) in query expression 'Table2 *'


Thanks again for helping...
Please advice....

Code:
[FONT=Courier New]Sub SelectIntoX()[/FONT]
[FONT=Courier New]   Dim dbs As Database[/FONT]
[FONT=Courier New]   Dim qdf As QueryDef[/FONT]
[FONT=Courier New]   ' Modify this line to include the path to Northwind[/FONT]
[FONT=Courier New]   ' on your computer.[/FONT]
[FONT=Courier New]   Set dbs = CurrentDb[/FONT]
[FONT=Courier New]   ' Select all records in the Employees table[/FONT]
[FONT=Courier New]   ' and copy them into a new table, Emp Backup.[/FONT]
[FONT=Courier New]   dbs.Execute "SELECT Table2 * INTO [Table2i] FROM Table2;"[/FONT]
 
[FONT=Courier New]   ' Delete the table because this is a demonstration.[/FONT]
[FONT=Courier New]   dbs.Execute "DROP TABLE [Table2];"[/FONT]
 
[FONT=Courier New]   dbs.Close[/FONT]
[FONT=Courier New]End Sub[/FONT]
 

Users who are viewing this thread

Back
Top Bottom