Results 1 to 4 of 4

Thread: [RESOLVED] Altering a String

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2005
    Location
    Baker, Louisiana
    Posts
    34

    Resolved [RESOLVED] Altering a String

    I'm creating a new access table. I need to pull information out of the old table and insert it into the new table. When I try this I receive a syntax error in query expression. This is because I'm tying to insert a string of 117 characters which contains an apostrophe ('). Is there a way to search through the entire string and remove the apostrophe? Any help would be greatly appreciated.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Altering a String

    VB Code:
    1. MyString = Replace(MyString, "'", "")

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Altering a String

    If you want to preserve the apostrophe in the database, use
    VB Code:
    1. MyString = Replace(MyString, "'", "''")
    If you escape the apostrophe with another apostrophe Access will store one apostrophe, which you'll get back when you select that field.

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2005
    Location
    Baker, Louisiana
    Posts
    34

    Smile Re: Altering a String

    Thanks for all you help Hack and Al42. That's exactly what I needed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width