I want a text field which should accept only text not number . How can i do that?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Suhas Parchure

    #1

    I want a text field which should accept only text not number . How can i do that?

    I want a text field which should accept only text not number . How can i do that?
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    You have to use validation. My advice would be to use the key press event. Something like the following.

    Code:
    Private Sub MyTextBox_KeyPress(KeyAscii As Integer)
    
        If KeyAscii >= 48 And KeyAscii <= 57 Then
            KeyAscii = 0
            MsgBox "You cannot enter numbers only text"
        End If
        
    End Sub

    Comment

    • mshmyob
      Recognized Expert Contributor
      • Jan 2008
      • 903

      #3
      Ignore this.

      Comment

      Working...