Results 1 to 4 of 4

Thread: Validate

  1. #1
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    19

    Unanswered: Validate

    Hi

    I'm trying to validate a name field so that it allows and letter, -, ` and ' but I'm not sure how to allow the user to enter a single quote. Does anyone have any suggestions?

    This is what I've got so far:

    For i = 1 To Len(name1)
    If (Mid$(name1, i, 1) Like "[A-Za-z-' ]") Then
    Invalid = False
    End If

    Next i

    I would appreciate any help anyone has to offer.

    Thanks in advance.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Is this a text box that a user will be entering characters (and you want to validate what they enter) ?

  3. #3
    Join Date
    Nov 2003
    Location
    Lahore, Pakistan
    Posts
    5

    Re: Validate

    replace all one single quote ' with '' two single quotes
    name1 = replace(name1,"'","''")

    Khurram

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    replace all one single quote ' with '' two single quotes
    name1 = replace(name1,"'","''")
    This will help when inserting into a database - but I think he wants to validate the textbox itself based on a particular range of characters.

Posting Permissions

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