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

Updating a record

Status
Not open for further replies.

Junkie88

Technical User
Mar 1, 2008
60
US
I am trying to save the value of a text field on the access form into a table using Update statement.

CurrentDb.Execute "UPDATE PATIENT SET DROPOUT_REASON = '"&
txtReasonDO.Value & "' WHERE PATIENT_ID = "& 1 & ";"

I get errors when I have commas or quotation marks in the text fields, but when I remove all the punctuation then it is working fine. Anyone knows how I can save the text fields, so it also allows me to store commas and quotations.
 
Code:
CurrentDb.Execute "UPDATE PATIENT SET DROPOUT_REASON='" & Replace(Me!txtReasonDO, "'", "''") & "' WHERE PATIENT_ID=1;"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top