Any way to disable hotkeys at login form (1 Viewer)

dhop1990

Registered User.
Local time
Today, 16:14
Joined
Oct 25, 2013
Messages
20
Basically, I have a fully functioning frmLogin that appears when the database opens. After correctly logging in, it takes you to the appropriate switchboard. The problem is that I set autokeys to allow F1 to automatically open the switchboard, but I don't want users to hit this to bypass my login screen. The reason for keeping the switchboard open is to force the user to close the database using the switchboard(eventually I want to limit the user to only the forms that I have created in a split database).

Any suggestions?

My other option that I tried first was writing a module that would detect when all forms are closed, then open the switchboard. But I kept getting Error91 and got frustrated/stopped attempting this method. Using the hotkey gives the user a similar functionality, but less conveniently so(since its not an automated process, etc.). I could post this code if someone thinks this is a better option.
 

David R

I know a few things...
Local time
Today, 15:14
Joined
Oct 23, 2001
Messages
2,633
When you say Switchboard, do you mean the Navigation Panel on the left side of the main Access window? Usually a Switchboard is just a form set up to run automatically, and you should be able to trap the use of that without allowing your users access to the nav panel, but I think we need more information...
 

Solo712

Registered User.
Local time
Today, 16:14
Joined
Oct 19, 2012
Messages
828
Basically, I have a fully functioning frmLogin that appears when the database opens. After correctly logging in, it takes you to the appropriate switchboard. The problem is that I set autokeys to allow F1 to automatically open the switchboard, but I don't want users to hit this to bypass my login screen. The reason for keeping the switchboard open is to force the user to close the database using the switchboard(eventually I want to limit the user to only the forms that I have created in a split database).

Any suggestions?

My other option that I tried first was writing a module that would detect when all forms are closed, then open the switchboard. But I kept getting Error91 and got frustrated/stopped attempting this method. Using the hotkey gives the user a similar functionality, but less conveniently so(since its not an automated process, etc.). I could post this code if someone thinks this is a better option.

You can trap the user hitting the F1 key with the KeyDown event. Make it conditional so when Login has been completed the restriction no longer applies, i.e.

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)       
     Select Case KeyCode
     Case vbKeyF1          
          If Not LoggedIn Then KeyCode = 0  ' ignores the stroke
     '
     ' insert traps for other hot keys 
     '
     End Select
 End Sub

LoggedIn should be set as a global variable.

Best,
J.
 

dhop1990

Registered User.
Local time
Today, 16:14
Joined
Oct 25, 2013
Messages
20
When you say Switchboard, do you mean the Navigation Panel on the left side of the main Access window? Usually a Switchboard is just a form set up to run automatically, and you should be able to trap the use of that without allowing your users access to the nav panel, but I think we need more information...

Yea, what my program currently does is run an AutoExec module to boot a login system using frmLogin. After a successful login, it opens a SwitchBoard form (frmSwitchboard) based on which login was used. The switchboard then grants access to opening different forms, etc.

I definitely should have been more clear about what I meant in the original post. Thanks again


You can trap the user hitting the F1 key with the KeyDown event. Make it conditional so when Login has been completed the restriction no longer applies, i.e.

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)       
     Select Case KeyCode
     Case vbKeyF1          
          If Not LoggedIn Then KeyCode = 0  ' ignores the stroke
     '
     ' insert traps for other hot keys 
     '
     End Select
 End Sub

LoggedIn should be set as a global variable.

Best,
J.

This worked perfectly, thanks a ton. I suppressed the hot F1 hotkey and now they don't have access to the SwitchBoard until after login condition has been met.
 

Solo712

Registered User.
Local time
Today, 16:14
Joined
Oct 19, 2012
Messages
828
This worked perfectly, thanks a ton. I suppressed the hot F1 hotkey and now they don't have access to the SwitchBoard until after login condition has been met.

Glad to help. :)
 

Users who are viewing this thread

Top Bottom