Results 1 to 3 of 3

Thread: Text Box Validation

  1. #1
    Join Date
    Jan 2003
    Location
    Dallas, TX
    Posts
    6

    Question Text Box Validation

    Does anyone know how to set the Validation Rule for a text box to Integer or Number with no decimal points allowed? Integer is not a selection in Format and I tried all combinations with the Decimal Places at 0. I do not want it to round. I want it to error out, if a decimal is used. I tried > 0 or is null in the validation field; however, it allows 2.5 or .58. I am new to forms designing in Access. Any suggestions???

  2. #2
    Join Date
    Jan 2003
    Location
    FL
    Posts
    13
    You can use the KeyPress Event. Here's an example:

    Code:
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If Chr(KeyAscii) < 0 Or Chr(KeyAscii) > 9 Then
            Text1.Text = ""
            KeyAscii = 0
            MsgBox "You can't do that!"
        End If
    End Sub
    
    Cheers,
    Gary

  3. #3
    Join Date
    Jan 2003
    Location
    Dallas, TX
    Posts
    6
    Thanks, I will give it a try.

Posting Permissions

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