Hello.
I have the following code on Keypress of a textbox. to limit the repsonse to just numbers. Which works great!
However I need it to only allow four digits and be able to use the backspace key to delete.
But it allows any length of number and also wont allow the backspace key to delete.
Any help please! Thanks.
Code:Private Sub txtEntranceDoorsFlatsRenewYear_KeyPress(KeyAscii As Integer) Const Number$ = "0123456789" ' only allow these characters If KeyAscii <> 4 Then If InStr(Number$, Chr(KeyAscii)) = 0 Then KeyAscii = 0 Exit Sub End If End If End Sub