简体   繁体   中英

Microsoft Access - VBA right click shortcut menu code locks shared database every time

I have a compiled Access database with a front-end (where this code is running) and compiled back end data storage.

I have code to create a shortcut menu, if inserted into the start-up routine of the database, MS Access ignores the default setting to open as shared mode on the Access database, and opens as Exclusive mode. This is causing a lot of problems.

Public Sub sbCreateReportShortCutMenu()

Dim cmbRightClick as Office.CommandBar

Set cmbRightClick =  CommandBars.Add("cmdFormRightClick", 0,, True)
Set cmbRightClick = Nothing

End Sub

Moving the code so it only runs when needed (before opening forms in this case), the issue still occurs. If the first user in the database opens a form which requires this code, and nobody else is in the database at the time, the database goes in to exclusive mode and other people can't access it.

All PCs/people accessing the database front end have Access set to shared/no locks as default.

What is it about this code causing the shared database to lock? Any ideas please? Thank you in advance

CommandBars were deprecated. You need to use the Fluent UI for customizing Office UI. Read more about the Fluent UI (aka Ribbon UI) in the following articles:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM