Results 1 to 3 of 3
  1. #1
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115

    Getting HTML text as Plain Text into a DB field

    Hi.



    I need to populate a DB field in a specific table that will be picked up by a third party system and be used to publish to a web page. The field is called "Full description" and is format Long Text / Plain Text. I cant change these.

    I need to add the following string which consists of description and then a html formatted statement showing when it will arrive. An example is:

    Grand Canal by Kate Spain for Moda. This bright, colourful collection will send you on a marvellous gondola ride through Venice, Italy. !!<<font color='#82558c' size='4'><BR><BR><B> Coming soon in September </size></font></B>>!!
    The field is showing correctly in my form (as per example above) in field Me.SectionPageDesc

    Code:
         
    SectionPageDescString = Me.SectionPageDesc
    
    
    ' Save Data for Main Product
       
      strUpdate = "UPDATE [Catalog section]" & _
        "SET  [Catalog section].sSectionDescription = '" & SectionDescString & "'" & _
        " WHERE [Catalog section].nSectionID = " & Val(Me.sectionID) & ";"
    
    
       db.Execute strUpdate, dbFailOnError
    Unfortunately this DB update fails. I guess because it gets confused with my single quotes.

    If i take out the HTML and update with only:

    Grand Canal by Kate Spain for Moda. This bright, colourful collection will send you on a marvellous gondola ride through Venice, Italy.
    The DB Update succeeds.

    I tried to
    Code:
    SectionPageDescString = Trim(Replace(Me.SectionPageDesc, "'", "''"))
    to help with the single quotes. The update succeeds but the resulting field in the db seems to get 2 single quotes ('') so the HTML does not display correctly on the webpage.

    Please could some advise me how to get the field correctly formatted (as per 1st quote) so it apears exactly like that in the DB field?

    Many thanks

    tony

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try:

    "SET [Catalog section].sSectionDescription = " & Chr(34) & SectionDescString & Chr(34) & _
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Need a space here:
    Code:
    strUpdate = "UPDATE [Catalog section] " & _

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

Similar Threads

  1. Replies: 1
    Last Post: 01-24-2017, 01:05 PM
  2. Replies: 3
    Last Post: 02-23-2015, 02:13 PM
  3. HTML characters in plain text field
    By etorasso in forum Access
    Replies: 3
    Last Post: 09-25-2014, 11:47 AM
  4. Button to Open HTML contained in Text Field
    By Douglas Post in forum Access
    Replies: 1
    Last Post: 01-22-2012, 12:12 PM
  5. Convert rtf to plain text
    By techneophyte in forum Programming
    Replies: 0
    Last Post: 09-08-2010, 11:13 AM

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