Change command button function with shift or alt

  • Thread starter Thread starter vircalendar via AccessMonster.com
  • Start date Start date
V

vircalendar via AccessMonster.com

I would like to "hide" a feature on a form by coding a command button to do
one action if it is clicked and another if it is clicked while the shift or
alt key is pressed. My goal is to keep handy (for those in the know) an
option that not all users of the shared DB need. ANy ideas?
 
Use the MouseUp (or MouseDown) event instead of Click.
The Shift argument gives you info about the state of the Shift, Ctl, and Alt
keys.

Example:

Private Sub cmdTest_MouseUp(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
Debug.Print "Clicked at " & Now();

If Shift And 1 Then
Debug.Print , "Shift";
End If

If Shift And 2 Then
Debug.Print , "Ctl";
End If

If Shift And 4 Then
Debug.Print , "Alt";
End If

Debug.Print
End Sub
 
Perfect. Thanks
I would like to "hide" a feature on a form by coding a command button to do
one action if it is clicked and another if it is clicked while the shift or
alt key is pressed. My goal is to keep handy (for those in the know) an
option that not all users of the shared DB need. ANy ideas?
 
Back
Top