vbams-accessdebugging

Why does Access-Vba stops even if AllowSpecialKeys is turned off?


We use AllowSpecialKeys=false in our vba-Access-databases to disable the "stop" commands in the version we deploy to the customers.

https://learn.microsoft.com/de-de/office/vba/access/concepts/miscellaneous/allowspecialkeys-property

This works fine in Windows <=10 and office 16.

Now we want to change to Windows 11 and office 365. Unfortunately it seems like microsoft changed the functionality of AllowSpecialKeys and the code breaks at the stop command and opens the VBA-Development-Enviroment. This is nothing our customer should see.

Do you know anything about this? Any information about a workaround?


Solution

  • This is intentional and relates to Access, not Windows.

    Last year a developer reported to Microsoft that setting the Allow Special Keys option to No was preventing VBA from stopping at breakpoints set by a developer, which was obviously undesirable.

    Thas was fixed, so now setting Allow Special Keys to No prevents a user from breaking into code with Ctrl+Break, but does not prevent VBA from stopping at breakpoints, or Stop statements.

    So, this change was intentional, and is a demonstration of how making any change, even if it is obviously correct, can cause someone some pain.

    So, this someone is you, and I guess you'll have to adapt, as most developers, including me, as well as Microsoft will vote for the current behaviour not to be reverted.