Run-time Error : 3144 at UPDATE sql

S

siaosanko

Hi,

I'm writing in VBA / MS Access and i got an error again for "Run-time
Error : 3144" at Update statement.

I tried a ";" at the end but it's still not working... ( both ";"
or ; at the end)
I put single quot around "&NOTE&" but it's still not working
either
I can't figure it out what wrong. please help! Thanks much!

==============================================
Dim Note As String
NOTE = "Undecide"

strSQL = "UPDATE Result SET note = " & NOTE & " WHERE Proc ='" & Trim
(rsTarget!Proc) & "'"
CurrentDb.Execute (strSQL)

==============================================

Thanks much!!
 
S

siaosanko

Hi,

I'm writing in VBA / MS Access and i got an error again for "Run-time
Error : 3144" at Update statement.

I tried a ";" at the end but it's still not working... (  both ";"
or ;  at the end)
I put single quot around    "&NOTE&"   but it's still not working
either
I can't figure it out what wrong. please help! Thanks much!

==============================================
Dim Note As String
NOTE = "Undecide"

strSQL = "UPDATE Result SET note = " & NOTE & " WHERE Proc ='" & Trim
(rsTarget!Proc) & "'"
CurrentDb.Execute (strSQL)

==============================================

Thanks much!!

by the way, I meant Dim NOTE as String for the first line ----> not
working anyway
Please any input .thanks.
 
P

Piet Linden

Dim Note As String
NOTE = "Undecided"

strSQL = "UPDATE Result SET note = " & NOTE & " WHERE Proc ='" & Trim
(rsTarget!Proc) & "'"
CurrentDb.Execute (strSQL)

try this instead
Const cQUOTE As String = "'"
strSQL = "UPDATE Result SET note = cQUOTE & NOTE & cQUOTE & " WHERE
Proc ='" & Trim
(rsTarget!Proc) & "'"
 
R

RoyVidar

Hi,

I'm writing in VBA / MS Access and i got an error again for "Run-time
Error : 3144" at Update statement.

I tried a ";" at the end but it's still not working... ( both ";"
or ; at the end)
I put single quot around "&NOTE&" but it's still not working
either
I can't figure it out what wrong. please help! Thanks much!

==============================================
Dim Note As String
NOTE = "Undecide"

strSQL = "UPDATE Result SET note = " & NOTE & " WHERE Proc ='" & Trim
(rsTarget!Proc) & "'"
CurrentDb.Execute (strSQL)

==============================================

Thanks much!!

Note is a reserved word both in Access and Jet, and should be
avoided as name of field and variables.

Proc is a reserved word in Jet, and shouldn't be used as field name.

Sometimes you can get away by using [brackets]

Dim TheNote As String
TheNote = "Undecide"

strSQL = "UPDATE Result SET [note] = '" & TheNote & _
"' WHERE [Proc] ='" & Trim (rsTarget![Proc]) & "'"

(note also single quotes - as it seems [note] is a text feld)

I put a couple of lists of reserved words in a reply to your other
post.
 
L

littlestone

I'm writing in VBA / MS Access and i got an error again for "Run-time
Error : 3144" at Update statement.
I tried a ";" at the end but it's still not working... (  both ";"
or ;  at the end)
I put single quot around    "&NOTE&"   but it's still not working
either
I can't figure it out what wrong. please help! Thanks much!
==============================================
Dim Note As String
NOTE = "Undecide"
strSQL = "UPDATE Result SET note = " & NOTE & " WHERE Proc ='" & Trim
(rsTarget!Proc) & "'"
CurrentDb.Execute (strSQL)

Thanks much!!

Note is a reserved word both in Access and Jet, and should be
avoided as name of field and variables.

Proc is a reserved word in Jet, and shouldn't be used as field name.

Sometimes you can get away by using [brackets]

 Dim TheNote As String
 TheNote = "Undecide"

 strSQL = "UPDATE Result SET [note] = '" & TheNote & _
          "' WHERE [Proc] ='" & Trim (rsTarget![Proc]) & "'"

(note also single quotes - as it seems [note] is a text feld)

I put a couple of lists of reserved words in a reply to your other
post.

Thanks!!! I tried and it works with the [].
 

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

Top