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!

Updating a table with sql

Status
Not open for further replies.

oxenss

Programmer
Jun 20, 2003
8
0
0
US
I am trying to update a table when a selection is double clicked i keep getting a error that i am missing an operator in my sql here is what my sql looks like

Dim sql As String

sql = "UPDATE CitationComment SET CitationComment.Citation_Viewed = " & True & " " & _
" WERE (comment_ID = " & citid & " & Employee_ID = " & empid & ")"

Dim updtecit As New update(sql, "EmpFrmCitation")
updtecit.editData()
updtecit = Nothing

I think I am close on this but have been fighting with it for a while now any help would be very much apreciated

thank you in advance

The OX
 
why don't you debug the program, and put a break after the assignation to the sql variable, and check the content of the sql variable, because for example if citid is string or empid is string, you need to put "'"... or maybe with the TRUE...
 

first of all WHERE is spelt wrong. Following is the update string

Dim sql As String

sql = "UPDATE CitationComment " & _
"SET Citation_Viewed = " & "True" & " " & _
"WHERE comment_ID = " & citid & _
" AND Employee_ID = " & empid

make sure you have declared citid & empid



Email: pankajmsm@yahoo.com
 
If you are updating a character field, you need single quotes around the value. If it is a bit field, then use 1 or 0.
 

well you can update character fields with double quotes as well. What if your string contains single quote in it (O'Neil, O'Donahue) etc. Better off using double quotes


Email: pankajmsm@yahoo.com
 
thank you all for the help going to try some of the tips right now

thank you again

The OX
 
I've never heard of using double quotes in anything but Access. I use two single quotes to denote a single quote, the whole thing wrapped in singles quotes. Basically a replace function on the single quote character with two of them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top