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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax error in sql statement

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
0
0
CA
HELP I am new to sql and have been staring at the following INSERT statement for too long

it comes back with a syntax error

msRequestTable = "printrequesttable"


sSQL = "INSERT INTO " & _
msRequestTable & " " & _
"(data_capture_dt,doc_id,code,label,queue,jobhost,printer,priority,defertime,repeatint,apppath,links,execorder,parameters,status,eb_key_id) " & _
"VALUES ('" & dtmDataCaptureDate & "', " & _
icode & ", " & _
"'" & sDocID & "', " & _
"'" & sLabel & "', " & _
"'" & sQueue & "', " & _
"'" & sJobHost & "', " & _
"'" & sPrinter & "', " & _
iPriority & "," & _
iDeferTime & "," & _
iRepeat & "," & _
"'" & sAppPath & "'," & _
"'" & sLinks & "', " & _
iExecorder & "," & _
"'" & sParameters & "'," & _
"'" & sStatus & "'," & _
"'" & sKeyData1 & "'" & ")"


I know this is a long shot Maybe I will get lucky!!
the fields I am putting into the table match the fields in the table in other words I am not trying to put a integer into a string field etc
 
Hey you might have gotten lucky!

The problem with the query is that "parameters" is a reserved keyword. If you put brackets around the field name your query should run.

Here's the section of code modified with the brackets to let access know parameters is a field name instead of a key word:

... "(data_capture_dt,doc_id,code,label,queue,jobhost,printer,priority,defertime,repeatint,apppath,links,execorder,[parameters],status,eb_key_id) " & _ ....

Hope this solves your problem!

Lionel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top