Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hotkey problem

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, In Access 2002 we have the AllowBypassKey set to false. We have an AutoKeys macro for a few shortcuts.

The problem comes when the user does a CTRL , (comma) or CTRL . (period).

I need to prevent the use of these.

Thanks
djj
 
The problem being the user is able to switch from form view to other views through shortcuts?

One method, which does something entirely else, is to add a module level boolean variable, which is set to false on load, then only set to true when using your own custom close-button. Perform a check on this variable in the forms on unload event, and cancel that event, if the module level variable isn't true.
[tt]
Private OKToClose as Boolean

Private Sub Form_Load()
OKToClose = False
End Sub

Private Sub TheCustomCloseButton()
OKToClose = True
DoCmd.Close acForm, Me.Name
End Sub

Private Sub Form_Unload(Cancel As Integer)
If Not OKToClose Then Cancel = True
End Sub[/tt]

Since changing view will trigger an unload event, this is prevented. It will also prevent users from closing the app/form unless using your custom close button.

Also, where you using mde in stead of mdb, design view would be prevented, then you could just disallow the other views in the forms format properties.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top