Apostrophe or single quote in a text field with rich text format does not take

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • p4willi
    New Member
    • Jun 2010
    • 22

    Apostrophe or single quote in a text field with rich text format does not take

    I have an unbound text box called Notes on a MS Access 2007 form with the Text Format property set to Rich Text.

    The underlying database has a Memo field called NOTES with it's property set to Rich Text.

    When I try to enter some text enclosed in apostrophes/single quotes (eg. 'test') into the form field Notes and press my save button to do an update I run into a problem as enclosed in the text file.

    Is there anyway to capture the apostrophe/single quote into the table and retain all the RTF features ? Need help on this.

    Here is my update statement
    Code:
    SQLUpdMain = "UPDATE CA_NIGHTLY SET AUDIT_DATE =#" & Me.txt_main_aud_date & "#," & "AUDIT_STATUS =" & "'" & Me.cbo_main_aud_status & "',"
    SQLUpdMain = SQLUpdMain & "NOTES =" & "'" & Me.txt_main_Notes & "'" & ",OVERPAID =" & Ovp_Cur & ",UNDERPAID =" & Unp_Cur
    SQLUpdMain = SQLUpdMain & ",UPDATED_BY =" & "'" & strUser & "'," & "UPDATED_DATE =#" & CurrentDate & "#"
    SQLUpdMain = SQLUpdMain & " WHERE AUDIT_CLAIM_NUMBER =" & [Forms]![frmMain]![txt_main_aud_clmno].[Value]
    Attached Files
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Code:
    strValToUpdateInsert = Replace(RTB.RTFText, "'", "''")
    This will make things like can't look like can''t but when you retrieve it, it will come out right (can't) as it will be stored with only the single tick...



    Good Luck

    Comment

    • p4willi
      New Member
      • Jun 2010
      • 22

      #3
      Originally posted by vb5prgrmr
      Code:
      strValToUpdateInsert = Replace(RTB.RTFText, "'", "''")
      This will make things like can't look like can''t but when you retrieve it, it will come out right (can't) as it will be stored with only the single tick...



      Good Luck
      Works - sweet... Thanks much

      Comment

      Working...