help woith syntax..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone with good eye for syntax see the issue with this..getting syntax err..

strSql = "INSERT INTO [UpdatedTPlanMedication] ( UpdatedTPlanID#,
Medication, Reason, Response, Dose, SideEffect, IsMerged, TimeStamp ) " & _
"SELECT " & lngID & " As NewID, Medication, Reason, Response,
Dose, SideEffect, IsMerged, TimeStamp " & _
"FROM [UpdatedTPlanMedication] WHERE [UpdatedTPlan#] = " &
Me.[UpdatedTPlanID#] & ";"
DBEngine(0)(0).Execute strSql, dbFailOnError

thanks,
don
 
ps..I'm down to now where it when i run in Query designer/SQL view, it gives
syntax error and highlights
the TimeStamp field..(linking to sql server table)

thanks,
don
 
If TimeStamp is really a field of the type TimeStamp, I think you should
drop it from the query. TimeStamps are system generated.

timestamp data type: A SQL Server system data type that is a monotomically
increasing counter whose values are always unique within a database.
Also, I would bracket your fields with # marks
 
ps..I'm down to now where it when i run in Query designer/SQL view, it gives
syntax error and highlights
the TimeStamp field..(linking to sql server table)

SQL timestamps are not updateable - they're maintained automatically.
I'd suggest just leaving the field out of both the INSERT INTO and
SELECT clauses.

John W. Vinson[MVP]
 
Thanks so much John!

John Spencer said:
If TimeStamp is really a field of the type TimeStamp, I think you should
drop it from the query. TimeStamps are system generated.

timestamp data type: A SQL Server system data type that is a monotomically
increasing counter whose values are always unique within a database.
Also, I would bracket your fields with # marks
nycdon said:
Anyone with good eye for syntax see the issue with this..getting syntax
err..

strSql = "INSERT INTO [UpdatedTPlanMedication] ( [UpdatedTPlanID#],
Medication, Reason, Response, Dose, SideEffect, IsMerged) " & _
"SELECT " & lngID & " As NewID, Medication, Reason, Response,
Dose, SideEffect, IsMerged" & _
"FROM [UpdatedTPlanMedication] WHERE [UpdatedTPlan#] = " &
Me.[UpdatedTPlanID#] & ";"
DBEngine(0)(0).Execute strSql, dbFailOnError

thanks,
don
 

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