Control TextBox !

G

Golenboy

Hello all
I will have to develop a userform and I want to control the value of
TextBox which must be an integer not null. What do I have to do? I
wrote this but it is not the good code!!

Private Sub TextBoxl_Change()
Dim KeyAscii As MSForms.ReturnInteger
Select Case KeyAscii
Case Is < 49, Is > 57
MsgBox "Only a non null interger is allowed."
KeyAscii = Asc(Chr(8))
End Select
End Sub
 
M

missinglinq via AccessMonster.com

Would this do it?

Private Sub Text0_Change()
If Asc(Me.Text0.Text) < 49 Or Asc(Me.Text0.Text) > 57 Then
MsgBox "Only a non null interger is allowed."
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top