I have this form, that responds to the up and down arrows..... i want it not to be able to be used when it is out of focus. i put this code...

Code:
Private Sub Form_GotFocus()
    keysallowed = True
    frmMainForm.Tag = 1
End Sub
Private Sub Form_LostFocus()
    keysallowed = False
    frmMainForm.Tag = 0
End Sub
but for some reason, when i click on another window, it still reponds! I even put it to where if the keysallwoed = true AND frmmainform.tag = 1 then respond to the keys.... why is it doing this?