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

Update SQL Error

Status
Not open for further replies.

mrbboy

Technical User
Feb 28, 2007
136
US
I pasted the following sql query behind a command button to change the text in a text box from OPEN to CLOSE but I am getting an error message. Can someone tell me what's wrong?

dim sql as string

sql = "UPDATE tbl_CARGeneral SET tbl_CARGeneral.Status = "CLOSE""
sql = sql & "WHERE (((tbl_CARGeneral.Status)="OPEN"));"
docmd.runsql sql
 
You have to use single quotes around CLOSE and OPEN:

Code:
Dim sql As String

sql = "UPDATE tbl_CARGeneral SET [Status] = 'CLOSE' "
sql = sql & "WHERE [Status]='OPEN';"
DoCmd.RunSQL sql


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top