Howlsta
Vampire Slayer
- Local time
- Today, 16:47
- Joined
- Jul 18, 2001
- Messages
- 180
I've got five similar fields where I want to use the same code for the keypress. Instead of pasting the same code 5 times i'd like to call another sub, but whatever I try I get variable not defined or argument not optional
Private Sub AIS3_KeyPress(KeyAscii As Integer)
Call AllowDigitsOnly(KeyAscii)
sub AllowDigitsOnly(Keyscii As Integer)
Select Case KeyAscii
Case 48 To 57, 32, 8 '8 is to allow for bkspace
KeyAscii = KeyAscii
Case Else
Beep
KeyAscii = 0
End Select
can anyone see what i'm doing wrong? Thanks
Rich
End sub
Private Sub AIS3_KeyPress(KeyAscii As Integer)
Call AllowDigitsOnly(KeyAscii)
sub AllowDigitsOnly(Keyscii As Integer)
Select Case KeyAscii
Case 48 To 57, 32, 8 '8 is to allow for bkspace
KeyAscii = KeyAscii
Case Else
Beep
KeyAscii = 0
End Select
can anyone see what i'm doing wrong? Thanks
Rich
End sub