What's wrong with this query

exaccess

Registered User.
Local time
Today, 08:39
Joined
Apr 21, 2013
Messages
287
Code:
strSQL = "INSERT INTO [" & dest & "] ([LastName], [FirstName], [Language]," & _
    " [Email], [Associatiom]) " & "SELECT FROM [" & Origin & "] ([LastName], [FirstName]," & _
    " [Language], [Email], [Federation])"
This is a query that I have to use to copy Origin = TransNMTbl to dest="TransTbl. Both source and destination can be variables. The column names and sizes are exactly he same except for the last one where only the name changes from Federation to Association. I get syntax error when I try to run it. What is the solution? Help please.
 
should be:


strSQL = "INSERT INTO [" & dest & "] ([LastName], [FirstName], [Language], , [Associatiom]) SELECT [LastName], [FirstName], [Language], [Email], [Federation] FROM [" & Origin & "]"
 
should be:


strSQL = "INSERT INTO [" & dest & "] ([LastName], [FirstName], [Language], , [Associatiom]) SELECT [LastName], [FirstName], [Language], [Email], [Federation] FROM [" & Origin & "]"[/QUOTE]

Dear Friend. Unfortunately it says syntax error in from phrase. Does not work.
 
this is one line only:

strSQL = "INSERT INTO [" & dest & "] ([LastName], [FirstName], [Language], , [Associatiom]) SELECT [" & Origin & "].[LastName], [" & Origin & "].[FirstName], [" & Origin & "].[Language], [" & Origin & "].[Email], [" & Origin & "].[Federation] FROM [" & Origin & "]"
 
this is one line only:

strSQL = "INSERT INTO [" & dest & "] ([LastName], [FirstName], [Language], , [Associatiom]) SELECT [" & Origin & "].[LastName], [" & Origin & "].[FirstName], [" & Origin & "].[Language], [" & Origin & "].[Email], [" & Origin & "].[Federation] FROM [" & Origin & "]"[/QUOTE]

I am copying the statement exactly on one long line. This did not work either.
 
instead of running the wuery put it in msgbox, then you will know what is the problem
 
Assuming that you posted your exact code, you have mis-spelled 'Association' with an 'm' at the end.

If that's not the problem, try typing debug.print line to view the output in the immediate window
 
Yes Association is the correct one, but that is only typo. In my code I corrected it. I'll try one of those techniques.
 
I had an application problem. At the extreme side my Origin and dest tables were the same. Now I have this Not enough memory 7 problem. But I'll have to start another thread. Many thanks.
 

Users who are viewing this thread

Back
Top Bottom