I want to change the startup properties of my database programmatically. I tried to do it by having a Sub SetStartupProperties() which contains compiler directives #If..#Else..#End if. The directive constant conVersiMDE is declared at the declaration section, as the codes attached show. The Sub was the first to be run when the database was started.
It works as exepcted when my application is run as a MDB file. However when it was compiled and run as a MDE, properties like “AllowShortcutMenus”, “AllowSpecialKeys” and “AllowBypassKey” were still available and I could access my shortcut menu, the special keys as well as use Shift to bypass startup setup. Can anyone help?
———————————————-
#Const conVersiMDE = True
Sub SetStartupProperties()
Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
ChangeProperty “StartupForm”, DB_Text, “frmMula”
ChangeProperty “AppTitle”, DB_Text, “Pangkalan Data Murid”
ChangeProperty “AppIcon”, DB_Text, “Murid.ico”
ChangeProperty “StartupMenuBar”, DB_Text, “Murid Menu Bar”
ChangeProperty “StartupShowDBWindow”, DB_Boolean, False
ChangeProperty “StartupShowStatusBar”, DB_Boolean, True
ChangeProperty “AllowBreakIntoCode”, DB_Boolean, False
ChangeProperty “AllowToolbarChanges”, DB_Boolean, False
#If conVersiMDE Then
ChangeProperty “AllowShortcutMenus”, DB_Boolean, False
ChangeProperty “AllowBuiltinToolbars”, DB_Boolean, False
ChangeProperty “AllowFullMenus”, DB_Boolean, False
ChangeProperty “AllowSpecialKeys”, DB_Boolean, False
ChangeProperty “AllowBypassKey”, DB_Boolean, False
Application.VBE.MainWindow.Visible = False
#Else
ChangeProperty “AllowShortcutMenus”, DB_Boolean, True
ChangeProperty “AllowBuiltinToolbars”, DB_Boolean, True
ChangeProperty “AllowFullMenus”, DB_Boolean, True
ChangeProperty “AllowSpecialKeys”, DB_Boolean, True
ChangeProperty “AllowBypassKey”, DB_Boolean, True
#End If
End Sub