Results 1 to 6 of 6
  1. #1
    anavagomez is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    31

    Question Escape double quotes around a single character within a string

    I am facing a problem that I hope I can get some help in this forum. I am retrieving values from a SQL Server data-table, loading them into an array to then use the array to add the items to a drop-down-list.


    The problem that I have is that one of the values contains double quotes around one of the characters of the string.




    This is the value: "A" Side Music, LLC


    Because of the double quotes around the A, that value is not included in the drop-down-list, all other values are present.


    The code that I have tried is this piece:

    Code:
        For intRecord = 0 To UBound(arrRecords, 2)
    
    
            Name.AddItem (Chr(34) & arrRecords(0, intRecord) & Chr(34))
    
    
        Next intRecord
    Is there any way someone could help me figure how to work around this problem?


    Many thanks

  2. #2
    anavagomez is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    31
    I forgot to mention that I also tried to use only: Name.AddItem avarRecords(0, intRecord)

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    try replacing the double quotes with two double quotes

    replace(arrRecords(0), Chr(34), Chr(34) & Chr(34))

  4. #4
    anavagomez is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    31
    did not work.

  5. #5
    anavagomez is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    31
    this worked:

    Code:
    Name.AddItem "'" & arrRecords(0, intRecord) & "'"

  6. #6
    anavagomez is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    31
    Thank you to Ajax for all his help to solve the issue I was having.

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

Similar Threads

  1. double/single quotes
    By SunTop in forum Programming
    Replies: 2
    Last Post: 12-13-2016, 02:24 PM
  2. Replies: 6
    Last Post: 07-12-2016, 02:59 PM
  3. need help with single and double quotes
    By vicsaccess in forum Programming
    Replies: 7
    Last Post: 12-27-2015, 06:40 PM
  4. Replies: 2
    Last Post: 05-29-2014, 09:30 PM
  5. Single and double quotes in a INSERT statement
    By dccjr in forum Programming
    Replies: 16
    Last Post: 03-14-2013, 09:50 PM

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