Append query via VBA

K

Kent

Hi

I need to add all data from a temp table into another table by using VBA.
Which is the easiest way to do this?
 
J

John Spencer

StrSQL = "INSERT INTO [YourTargetTable] (Field1, field2, field3)" & _
" SELECT FieldA, FieldB, FieldC FROM [YourSourceTable] "

Currentdb().Execute StrSQL,DbFailonError

Enter Insert Into in the Help Search and then select the Insert Into statement
item.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
R

Rob Wills

Or alternatively - if you're not comfortable with SQL... Build a standard
query then call it using the same method

Currentdb.execute "QueryNameHere"

================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top