If Shift and Click Then Open Form

A

ant1983

Hi,

I have code in the click event that opens a form (very straight forward
(just used the wizard).

What i now want to do is;

If the user holds in the SHIFT key and then clicks that same button another
form should open. If this can be done i'd further like the user to be able
to open another type of form if they hold ion the ALT or CTRL buttons
respectively.

How do i do this?

Thanks.

Wayne
 
J

John Spencer

Don't use the click event, use the Mouse up event.

You can check the value returned in the Shift variable

Shift The state of the SHIFT, CTRL, and ALT keys when the button specified
by the Button argument was pressed or released. If you need to test for the
Shift argument, you can use one of the following intrinsic constants as bit masks:

Constant Description

acShiftMask The bit mask for the SHIFT key.

acCtrlMask The bit mask for the CTRL key.

acAltMask The bit mask for the ALT key.

IF Shift and acAltMask then
...

elseIf Shift and acShiftMask then
...

elseIf Shift and acCtrlMask then
...

Else
...
End IF

That said, you are really trying to make this difficult for your users. Why
not present an option group with the various forms and then use the value of
the option group to determine which report gets run when your user clicks the
open form button.


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

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