Ambushsinger -
Yes, you can do this. Set up variable to hold the SQL string (e.g. strSQL),
and build your code into the string. For example:
strSQL = "INSERT INTO [" & strIntoTableName & "] SELECT * FROM [" &
strFromTableName & "];"
Debug.Print strSQL
The Debug.Print statement will display the evaluated code in the immediate
window if you have the code pane open during testing. This will help you
catch missing delimeters or typos more easily.
If you have problems, post your code and the results from the immediate
window so we can help.
--
Daryl S
"ambushsinger" wrote:
> I'm trying to append data from one table to another using a SQL string in VBA
> but the table names are always changing so I want to use variables for the
> table names. Any ideas?
|