Deactivate keys

G

Guest

I am trying to create a data entry form. As part of the process, I would
like to deactivate certain keys so the flow of the form is consistent. I
thought I could do as follows in a keydown event but it doesn't seem to be
working.

Am I missing something? Thanks in advance for your insight....

Greg


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

' 9 - Tab; 18 - Alt; 19 - Scroll; 33 - PgUp; 34 - PgDown; 35 - End;
36 - Home;
' 37 - LArrow; 38 - UArrow; 39 - RArrow; 40 - DArrow; 45 - Insert; 46 -
Delete;
'113 - F2; 114 - F3; 115 - F4; 116 - F5; 117 - F6; 118 - F7;
119 - F8;
'120 - F9; 121 - F10; 122 - F11; 123 - F12;
Select Case KeyCode
Case 18, 19, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123
KeyCode = 0
Case Else
'Debug.Print KeyCode, Shift
End Select
End Sub
 
A

Allen Browne

Greg, IMHO, this is the very worst way to handle the interface. Your users
will hate you for restricting the keystrokes they can use, and you will also
have to prevent them from using the mouse. Maybe it's personal opinion, but
I would certainly be trying to get my money back if I found I had bought
into an application like that.

The important question is probably WHY you want to rope the user down like
that.

Is it because you don't understand how to use the events Access provides?
For example, you can use the BeforeUpdate event of the *form* to perform the
record-level validation, verify that required fields are present and cancel
the entry if it should not be written to the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top