"Phil Reynolds" <ph*******@msn.comwrote in message
news:oc***************@nlpi061.nbdc.sbc.com...
Is there a way to trap for a Ctrl or Alt key when typing in a field? I
want to be able to perform an action when the user types Ctl+A or Alt+A or
whatever. I noticed the KeyDown function allows you to check for the state
of the Shift key. I'm looking for something like that for Ctrl and/or Alt.
Thank you.
In the OnKeyDown event proc:
Dim intCtrlDown As Integer
intCtrlDown = (Shift And acCtrlMask) 0
If intCtrlDown And KeyCode = vbKeyA Then
MsgBox "Ctrl-A was pressed"
End If
You also have constants for the other shift keys:
acAltMask
scShiftMask
To obtain KeyCode constants, search for 'keycode' in the object browser.