Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert entire table into another in access VBA 1

Status
Not open for further replies.

vburrows

Programmer
May 10, 2005
26
US
OK I am trying to insert all the info from a temp table (las-temp) to a permanent table (las-invoiceitems)
I keep getting a message about a missing semi colon at teh end of the statement but I do not think that is what is wrong can someone help?
Code:
Dim strsql As String


        strsql = "INSERT INTO [las-InvoiceItems] (PS, Descr, IDNUM, Price, Invoice)" & _
         " Values (PS, Descr, IDNUM, Price, Invoice) " & _
        "FROM [las-temp]"

Debug.Print strsql

DoCmd.RunSQL strsql
 


Hi,

Do you have SQL that does run correctly?

If so, copy the SQL code and assign to your string variable.

And, yes, there's a semicolon required.
Code:
        strsql = "INSERT INTO [las-InvoiceItems] (PS, Descr, IDNUM, Price, Invoice)" & _
         " Values (PS, Descr, IDNUM, Price, Invoice) " & _
        "FROM [las-temp];"

Skip,

[glasses] [red]Be Advised![/red] Dyslexic poets...
write inverse! [tongue]
 
thanks skip this code does not work for some other reason because when I add the semi-colon it blows up again
I have decided to use a much simpler statement and move on I appreciate your help. I think I have a typing error in this.
 
There's no need for the semicolon. The message you received, probably has something to do with the syntax you're using (values in stead of select). Try:

[tt]strsql = "INSERT INTO [las-InvoiceItems] (PS, Descr, IDNUM, Price, Invoice)" & _
" select PS, Descr, IDNUM, Price, Invoice " & _
"FROM [las-temp]"[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top