SQL in VBA

sambrierley

Registered User.
Local time
Today, 05:52
Joined
Apr 24, 2014
Messages
56
Hi all,

the below SQL i basically tring move a record from one table to another, the table a copies of one another and the AlphaName variable is a string.

I keep getting the incomplete query error, somethings missing but i havent the feintest what.
thanks for any help.

Code:
strSQL = "INSERT INTO [Holding Table].* SELECT ([Import Table].* FROM [Import Table] WHERE ([Import Table].[Alpha Name] = '" & AlphaName & "'));"
 
Shot in the dark, but try

strSQL = "INSERT INTO [Holding Table] SELECT [Import Table].* FROM [Import Table] WHERE [Import Table].[Alpha Name] = '" & AlphaName & "';"

Normally you have to specify the fields, but I don't think you do if the tables are identical.
 
Thank you very much, thats got it!!
 
Happy to help! please don't delete threads with responses. The solution could prove helpful to someone searching in the future.
 

Users who are viewing this thread

Back
Top Bottom