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

Synax error

Status
Not open for further replies.

ifeyinwa

Programmer
Mar 26, 2003
112
US
hey guys,
Have a quick question. The Sql statement below works.

SQlstmt = "Update tblopgaCom2 Set "
SQLStmt = SQlstmt & "comments ='" & "" & "',"
SQLStmt = SQlstmt & "priorcomments ='" & Strpriorcomments & "."&" "& ";" & vbcrlf & Strcomments & "',"
SQLStmt = SQlstmt & "updDate=#" & Date & "# "
SQLStmt = SQlstmt & " Where Test =" & Test
Conn.Execute(SQLStmt)


however I need to add another line after theline with the date statement which is
SQLStmt = SQlstmt & "Time =#" & time() & "# "
But when I do that I get a (Syntax error (missing operator) in query expression). Can anyone pls tell me what I am missing out
 
try this

SQlstmt = "Update tblopgaCom2 Set "&_
"comments ='',"&_
"priorcomments ='" & Strpriorcomments & ". ;" & vbcrlf & Strcomments & "',"&_
"updDate=#" & Date & "#, "&_
"Time =#" & time() & "# "&_
" Where Test ='" & Test &"'
 
also i put ' around your test variable,i'm assuming its its not a numeric field - if it is remove them
 
oh I just assumed that was OK 'cause it supposedly works as-is without the time.
 
This is what I have below and i still get an error message.
my test field is numeric.also my back end is access database

SQlstmt = "Update tblopgaCom2 Set "
SQLStmt = SQlstmt & "comments ='" & "" & "',"
SQLStmt = SQlstmt & "priorcomments ='" & Strpriorcomments & "."&" "& ";" & vbcrlf & Strcomments & "',"
SQLStmt = SQlstmt & "updDate=#" & Date & "#, "
SQLStmt = SQlstmt & "Time =#" & time() & "# "
SQLStmt = SQlstmt & " Where Test =" & Test
Conn.Execute(SQLStmt)
 
Time is a key word...

so wrap it around [] something like this


SQLStmt = SQlstmt & "[Time] =#" & time() & "# "

-DNG
 
You guys are the best. It worked Time is a reserved word.the [Time] worked.thanks as always
 
These kinds of finer details are always easily ignored...
I am glad that its working for you

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top