Results 1 to 9 of 9

Thread: String problem. simple 4 u but

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    164

    String problem. simple 4 u but

    Dear all

    strSQL = "associate_name = '" & Text2.Text & "'"
    rst.find strSQL

    gives an error bcoz Text2.text contain

    JOHN'S CLINIC

    It contains an apostrophy.
    How to deal with this.
    urgent pls
    thanx

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    I guess you can add \ before ' so you don't get that error. I'm not sure if it's that character though... I'm no expert with SQL, but this is a little thing I remember from somewhere...

    The string would be then JOHN\'S CLINIC

  3. #3

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    164
    Martin / Merri
    both does not work.
    some one urgent pls.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    164
    And the value in Text2.text is from the Table.
    So do not know how many times apostrophy is there and which place.
    Though this can be found out, it will be troublsome.
    Any simpler solution for this?

  6. #6
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Ok, try to convert it with %27 (which is the character code for ' - I don't know if SQL supports quoted printable coding though... (this is used in the HTML-urls)

  7. #7

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    164
    Its resolved

    strFind= Replace(Text2.text, " ' ", " ' ' " )
    strSQL = "associate_name = '" & strFind & "'"
    rst.find strSQL

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    164
    ok ok marty
    Thankx

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