Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    14

    Question Unanswered: Validation Rule for Text Field

    Hello,

    I have a text field and i don't want users to enter the Characters (#) Or (") Meaning no pound signs and no quotation marks. How can i achieve this. I've played with the validation rule example: <> # or ", but it doesn't work fore its give an error and any characters entered.

    Any feedback would be very helpful.

    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You trying to do this on the table level or form level?

    I'd handle it at form level, and rather than having a validation message come up having the user have to respond to it, interrupting the flow of data entry, I'd simply strip the forbidden characters after the data was entered.

    Code:
    Private Sub FieldName_AfterUpdate()
     Me.FieldName = Replace(Me.FieldName, Chr(34), "")
     Me.FieldName = Replace(Me.FieldName, Chr(35), "")
    End Sub
    Last edited by Missinglinq; 10-06-09 at 14:39.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    May 2003
    Posts
    14

    Smile Validation Rule

    Thanks A lot, it works! I appreciate you taking your time out. Have a great Day!

Posting Permissions

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