A recent question in the forums asked how to set certain options for the Current Database through code. Presumably, the purpose is to restrict the user from changing these settings manually when trying to bypass any security measures the developer designed into the database application. Doing a search through the Internet didn't produce a complete list of all possible database option settings, so I decided to put all the pieces of the puzzle together in one place.
So, what exactly are we talking about? Basically, we are interested in all the settings you can find in the Current Database tab when you open the Access Options window (see image below).
|
Access Options |
Application.SetOption
The following options can be set using the Application.SetOption command:
Option | Property | Value |
Compact on Close | Auto Compact | False |
Remove personal information from file properties on save | Remove Personal Information | True |
Use Windows-themed Controls on Forms | Themed Form Controls | True |
Enable Layout View | DesignWithData | True |
Check for truncated number fields | CheckTruncatedNumFields | True |
Preserve source image format | Picture Property Storage Format | 0 |
Convert all picture data to bitmaps | Picture Property Storage Format | 1 |
Track name AutoCorrect info | Track Name AutoCorrect Info | False |
Perform name AutoCorrect | Perform Name AutoCorrect | False |
Log name AutoCorrect changes | Log Name AutoCorrect Changes | True |
Show list of values in: Local indexed fields | Show Values In Indexed | True |
Show list of values in: Local nonindexed fields | Show Values In Non-Indexed | True |
Show list of values in: ODBC fields | Show Values In Remote | False |
CurrentDB.Properties
The following options can be set using the CurrentDB.Properties collection:
Option | Property | Value |
Application Title | AppTitle | Text |
Application Icon | AppIcon | Text |
Display Form | StartupForm | Text |
Display Status Bar | StartupShowStatusBar | True |
Overlapping Windows | UseMDIMode | 1 |
Tabbed Documents | UseMDIMode | 0 |
Display Document Tabs | ShowDocumentTabs | True |
Display Navigation Pane | StartupShowDBWindow | True |
Ribbon Name | CustomRibbonID | Text |
Shortcut Menu Bar | StartupShortcutMenuBar | Text |
Allow Full Menus | AllowFullMenus | True |
Allow Default Shortcut Menus | AllowShortcutMenus | True |
Examples:
Application.SetOption "Auto Compact", True
CurrentDB.Properties("AllowFullMenus") = False
CurrentDB.Properties.Append CurrentDB.CreateProperty("CustomRibbonID", dbText, "MyRibbon")
Original post date: February 27, 2013
Thanks DBGuy .... Good to have this info in one place
ReplyDeleteHello. Great compilation!
ReplyDeleteAnother property. To force the AutoKeys macro, you must use Application.SetOption "Key Assignment Macro", "Autokeys"
(from a question on www.mvp-access.com)
If you go to Access Options, under Display Navigation Pane is a Navigation Options button. Clicking that and then selecting Object Type in left pane gives Forms, Queries, Tables, etc., each with a checkbox. Only those enabled checkboxes will be displayed.
ReplyDeleteI want to programmatically control who gets access to what Object Type. Is there any way that you're aware of that would allow some people access do different levels like that? I already have UserName() capability, so the identification of users is easy. I just want to to turn those options on and off as needed.
Appreciate a direct email at reallygoodquotes@yahoo.com.
Hmm, not sure. Normally, as a developer, I just turn the whole thing off before deploying the app to the user. It's not considered good practice to allow users direct access to the tables.
DeleteHere's a useful link on this topic:
ReplyDeletehttps://docs.microsoft.com/en-us/office/vba/access/Concepts/Settings/set-options-from-visual-basic