Key Down Problem

MarkL

Registered User.
Local time
Today, 12:21
Joined
Dec 16, 2009
Messages
12
Hi,

I have forms that disable the Page Up and Page Down keys utilizing the following coding for Key Down in the Form properties.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case 33, 34
KeyCode = 0
End Select

End Sub

However, I have Memo fields in the forms for which I want the keys to be active when the fields have focus and then become disabled again when the fields do not have focus (that is, for all other fields and the form itself the keys are disabled).

Is there a way to do this?
 
Create a Boolean public variable for your form. Use the "On Focus" Event for each text box to set the variable to true or false.

Code:
If BooleanVariable then
   Select Case KeyCode
       Case 33, 34
          KeyCode = 0
    End Select
End If
 
Last edited:

Users who are viewing this thread

Back
Top Bottom