Results 1 to 5 of 5
  1. #1
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69

    Question Tring to insert text to a field that is text with na apostrophe

    Hi,
    The text that I am inserting go great untill I hit a name Like O'Rally then it bombs out. If I take out the apostrophe it goes great. No wI know how to wite code to go through nad rempove the apostrophes, but I was hoping that there was a way to get them in there; so the people would have the exact information.
    Is there a way to do this?



    Thank you
    itm

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'll guess at how you're doing it and offer this tutorial:

    http://www.baldyweb.com/BuildSQL.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69
    Hi,
    I appreacite the link but I am not seeing how I would apply it here, but may be I am missing something. What I have is a long up date string but where it is gettting stuck is on a name field that has an apostrophe in it here is what the code looks like.
    str1 = "Select * from tblTemp_Import "
    rs1.Open str1, cn

    rs1.MoveFirst

    While Not rs1.EOF

    str1 = "Update tblSAccounts Set [OwnerId] = '" & rs1![OwnerId] & "' "
    cn.Execute str1

    rs1.MoveNext
    Wend

  4. #4
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69
    I just found that if I put Val(rs1![OwnerId] )
    It worked.
    Thanks for you help though.
    itm

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The part that was relevant was that part that discussed working with fields that could have an apostrophe in them, and offereing the solution of using Chr$(34).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  2. Replies: 12
    Last Post: 06-04-2012, 10:55 AM
  3. calculat text box and insert to field
    By barakkadosh in forum Access
    Replies: 3
    Last Post: 05-15-2012, 12:45 PM
  4. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  5. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 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