Results 1 to 2 of 2
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question Replace "

    How do you go about replacing a " (double quote) in a string? I can't seem to get the replace() function to work properly. I am trying to append an HTML email that I build in VBA into a table. Only problem is I'm getting a syntax error when I try to run the append due to all the double quotes. Below is sample of code.



    Code:
        strEmail = strHeader & strBody  & strFooter
        mySQL = "INSERT INTO tblEmails_Sent ([EmailType], [EmailTo], [EmailBody], [UserID]) " & _
            "VALUES ('" & strEmailType & "', '" & strEmailAddr & "', '" & strEmail & "', '" & strUserID & "');"
        CurrentDb.Execute mySQL

  2. #2
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Disregard...It was the ' (single quote) that was causing my problem. Replace function worked just fine.

    Code:
    strEmail = strHeader & Replace(strBody, "'", "''") & strFooter

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2012, 06:42 AM
  2. urgent! replace "-" with nothing
    By bet in forum Programming
    Replies: 1
    Last Post: 03-27-2011, 07:32 AM
  3. Replace "," with " "
    By jgelpi16 in forum Programming
    Replies: 8
    Last Post: 08-30-2010, 07:15 PM
  4. replace values with "indicators"
    By JoeMap in forum Reports
    Replies: 3
    Last Post: 06-16-2010, 10:19 AM
  5. replace a empty field with the word "none" how??
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 11:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums