problems calling a sub routine "variable not defined" etc

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
 
Rich,

I think your problem is here:

sub AllowDigitsOnly(Keyscii As Integer)

Select Case KeyAscii

You will notice that they are spelled differently
 

Users who are viewing this thread

Back
Top Bottom