Results 1 to 3 of 3
  1. #1
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126

    Handleing apostrophes

    The code shown works until I come to a name with an apostrophy such as "Carroll O'Conner" then I am getting a blank. Any solutions?

    Code:
        SeriesList.RowSource = "SELECT [TVID], [TVSeries], [Overall#], [Season], [SeasonNum], [Title], [Director], [Writer], Format([DateAired],'ddd-mmm d/yyyy'), [Plot]" & _
                                "FROM TVEpisodeListQ WHERE (Writer) LIKE '" & WriterCmb & "';"
    Thanks


    Jim O

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    enclose your writer name in double quotes instead


    Code:
    "FROM TVEpisodeListQ WHERE [Writer] like """ & writercmb & """;"
    because you are attempting to insert double quotes inside double quotes you need to double them up

    i.e.

    if I wanted a string to just be " I would need something like

    str = """"

    four double quotes the outer quotes set the bound of the string the inner quotes must be doubled to produce the single quote string

  3. #3
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    Works great, thank you.

    Jim O

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

Similar Threads

  1. searching for names with apostrophes
    By kwelch in forum Programming
    Replies: 4
    Last Post: 01-12-2017, 11:23 AM
  2. sql variable with apostrophes
    By broecher in forum Programming
    Replies: 3
    Last Post: 04-23-2013, 11:00 AM
  3. Replies: 2
    Last Post: 04-17-2013, 04:59 AM
  4. Replies: 4
    Last Post: 09-05-2011, 11:10 PM
  5. Acces or excel, for handleing my data?
    By oo0tommyk0oo in forum Access
    Replies: 1
    Last Post: 07-07-2011, 11:27 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