Insert statement

S

smk23

I haven't quite caught on to getting this right. Thanks in advance for
helping my syntax. Something's wrong with the quote marks:

strInsert = "INSERT SentinelNodeSt(AppointmentID, EmpCreated,
EmpUpdated)" & _
" VALUES(" & mlngAppointmentID & ", ' " & fstrGetUserName & " ', ' " &
fstrGetUserName " ')"

TIA
 
M

Mark M

It looks like you're missing an ampersand near the end:
fstrGetUserName & " ')"
^
 
J

John Smith

You are missing the key word 'INTO', and unless you want to put spaces into
the data you need to remove them from inside your single quotes:

strInsert = "INSERT INTO SentinelNodeSt(AppointmentID, EmpCreated,
EmpUpdated)" & _
" VALUES(" & mlngAppointmentID & ", '" & fstrGetUserName & "', '" &
fstrGetUserName "')"

HTH
John
 
Top