Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Macros _ Bypass Autokeys Not Working

Posted by: brucedodds Jul 3 2019, 03:09 PM

Hello All,

Last week I set up an Autokeys macro to disable the F11 key. While testing, I swear that I used the Shift key when needed to bypass this macro. (Microsoft confirms that you should be able to use the Shift key to bypass AutoKeys https://support.office.com/en-ie/article/run-an-access-macro-by-using-a-keyboard-shortcut-0d267570-d3da-46eb-9bfb-a3c81af676be).

Today, using the Shift key to bypass AutoKeys is not working. To test, I imported the AutoKeys macro into a blank database. Still get the same result - F11 doesn't work regardless of whether I hold the Shift key down. This database does have the Use Access Special Keys option checked. F11 does work on databases without this Autokeys macro.

Has anyone encountered this before?

Thanks!

Bruce


Posted by: GroverParkGeorge Jul 3 2019, 03:28 PM

It would be helpful to see the actual coding in this macro....

But since you've already created a test accdb, can you upload it to review?

Compact & Repair the test accdb. compress it into a ZIP file and upload it here as an attachment.

Thanks.

Posted by: theDBguy Jul 3 2019, 03:31 PM

Hi Bruce. I just gave it a try and wasn't able to bypass the autokeys macro. So, my guess is maybe it used to work in older versions of Access but may not anymore?

Posted by: brucedodds Jul 3 2019, 03:40 PM

Here's the test file . . . I'll have to get NDAs from everyone . . .

 TestAutokeys.zip ( 16.21K ): 2
 

Posted by: GroverParkGeorge Jul 3 2019, 03:42 PM

NDA?

If you need an NDA from someone in order to look at it, let's delete it. We can't control who does or does not find and download it.

Posted by: brucedodds Jul 3 2019, 03:43 PM

Hi DBGuy,

I believe I was using Access 2016 for development last week. Anyhow, the Microsoft article I linked to said it applied to Access 2016.

best,

Bruce

Posted by: brucedodds Jul 3 2019, 03:44 PM

That was a joke about the NDA. Sorry for the confusion.

Posted by: GroverParkGeorge Jul 3 2019, 03:45 PM

Well, we have to take that sort of thing seriously. So it's not a problem?

Posted by: brucedodds Jul 3 2019, 03:46 PM

Here's the file again.

 TestAutokeys.zip ( 16.21K ): 2
 

Posted by: brucedodds Jul 3 2019, 03:46 PM

No, it's not a problem.

Posted by: isladogs Jul 3 2019, 05:39 PM

As the article in your link states:

QUOTE
The new key assignments are available as soon as you save the macro group, and are in effect every time that you open the database. If you want, you can bypass the key assignments (and many other startup options) by holding down the SHIFT key while you start the database.


I've checked in both A2010 & A2019 (365) and it does exactly what the quote states
However, holding the shift key down does not prevent you running the Autokeys macro manually

I've slightly modified your database to make this more obvious:
- added a message box to show when F11 is pressed
- added an autoexec macro that runs your autokeys macro

Now you will see a message box 'F11 pressed' when you run the app ...unless you hold down the shift key
The Autokeys macro can still be run manually with or without using the SHIFT key

Hope that helps

BTW where was an NDA mentioned before George mentioned it?

 TestAutokeys_v2.zip ( 18.96K ): 1
 

Posted by: GroverParkGeorge Jul 3 2019, 05:51 PM

I forgot to make the post visible again. I hid it pending confirmation of the potential issue.

Posted by: isladogs Jul 3 2019, 06:04 PM

Ah - thanks George - makes sense now!

Posted by: brucedodds Jul 3 2019, 10:49 PM

Thanks for the test file, Isladogs. It confirms that the Shift bypass isn't working for Autokeys.

Oh, well, I guess I'll just have to let this go. Thanks for the feedback, everyone.

Posted by: isladogs Jul 4 2019, 02:22 AM

QUOTE
Oh, well, I guess I'll just have to let this go.


Not necessarily ... depending on your purpose
As F11 is a standard keyboard shortcut in Access, you don't need Autokeys to make use of it.

If, for example, you want to disable it for certain users, that is possible by intercepting the key press and resetting the value to nothing.
To do so, use code such as

CODE
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'OPTIONAL - Add some code here to check users permission level e.g.
If UserLevel<>"Admin" Then
     'disable F11 key
    If KeyCode = vbKeyF11 Then KeyCode=0
End If

End Sub


NOTE: You need to set the form KeyPreview property to Yes for this to work

Posted by: gemmathehusky Jul 4 2019, 07:17 AM

Curious

I added another autokeys macros for shift[F11] +{F11} as well as the {F11} macro

Now F11 is toggling the navigation pane, but shift+F11 does nothing, well nothing visible.

Posted by: brucedodds Jul 7 2019, 04:49 PM

Thanks, Isladogs, for the suggestion. This system has 90 forms, so I don't think I'll use KeyDown.

Also, AutoKeys doesn't disable F11 when run manually.

I've added a form available only to certain Windows users that has a button that will pop open the ribbon and nav pane.