technohead
Technical User
Hi,
i am using the code below to validate a textbox, however if i hit the return key it brings up the msgbox " invalid entry".
i was wondering is there a way of allowing to press the return key,
thanks
If KeyAscii < 8 Or KeyAscii > 8 Then
If KeyAscii < Asc("'" Or KeyAscii > Asc("'" Then
If KeyAscii < Asc("-" Or KeyAscii > Asc("-" Then
If KeyAscii < Asc("A" Or KeyAscii > Asc("Z" Then
If KeyAscii < Asc("a" Or KeyAscii > Asc("z" Then
If KeyAscii < Asc(" " Or KeyAscii > Asc(" " Then
KeyAscii = 0 ' Cancel the character.
Beep ' Sound error signal.
With txtfirstname
.SelStart = 0 'Select the current entry
.SelLength = Len(.Text)
End With
End If
If KeyAscii = 0 Then
answer = MsgBox("Invalid entry"
End If
End If
End If
End If
End If
End If
i am using the code below to validate a textbox, however if i hit the return key it brings up the msgbox " invalid entry".
i was wondering is there a way of allowing to press the return key,
thanks
If KeyAscii < 8 Or KeyAscii > 8 Then
If KeyAscii < Asc("'" Or KeyAscii > Asc("'" Then
If KeyAscii < Asc("-" Or KeyAscii > Asc("-" Then
If KeyAscii < Asc("A" Or KeyAscii > Asc("Z" Then
If KeyAscii < Asc("a" Or KeyAscii > Asc("z" Then
If KeyAscii < Asc(" " Or KeyAscii > Asc(" " Then
KeyAscii = 0 ' Cancel the character.
Beep ' Sound error signal.
With txtfirstname
.SelStart = 0 'Select the current entry
.SelLength = Len(.Text)
End With
End If
If KeyAscii = 0 Then
answer = MsgBox("Invalid entry"
End If
End If
End If
End If
End If
End If