insert into syntax error

  • Thread starter Thread starter Co
  • Start date Start date
C

Co

Hi All,

I use following query to insert recs in a table:

sSQL = "INSERT INTO SID_Master_Archief IN " & sys.sDBMap &
"archief.mdb" & _
" SELECT ArchiefTmp.* FROM ArchiefTmp"

rsArchiefX.Execute (sSQL)

Now I get an error saying there is a syntax error in the sting.

MArco
 
What exactly does sSQL contain? Try using Debug.Print sSQL, then looking in
the Immediate Window (Ctrl-G) to see.
 
it might just be a missing space before archief.mdb: " archief.mdb".

HTH,

This is what I get from the Debug window:
INSERT INTO SID_Master_Archief IN 'D:\Archief.mdb' SELECT ArchiefTmp.*
FROM ArchiefTmp

Looks fine to me.

Marco
 
INSERT INTO SID_Master_Archief IN 'D:\Archief.mdb' SELECT ArchiefTmp.*
FROM ArchiefTmp

What type of object is rsArchiefX ?

Do the fields in SID_Master_Archief match up with the fields in
ArchiefTmp?

What happens when you run this query from the query builder (instead
of from code)?

Are you sure that is the correct syntax for modifying a table in
another database. I thought it was:

INSERT INTO [D:\Archief.mdb].SID_Master_Archief
SELECT *
FROM ArchiefTmp

but that might just be for the query builder.

-Kris
 
Hi All,

I use following query to insert recs in a table:

sSQL = "INSERT INTO SID_Master_Archief IN " & sys.sDBMap &
"archief.mdb" & _
" SELECT ArchiefTmp.* FROM ArchiefTmp"

rsArchiefX.Execute (sSQL)

Now I get an error saying there is a syntax error in the sting.

MArco

I made a quick check and my SQL became:
INSERT INTO Contacts ( FirstName, LastName ) IN 'D:\Documents and
Settings\Hans Kristian\My Documents\test.mdb'
SELECT MyContactTbl.FirstName, MyContactTbl.LastName
FROM MyContactTbl;

Sincerely
Hans Kristian Eide
 

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

Back
Top