3 replies
by stevenmatuszak Accepted solution
by ericrae Accepted solution
>Q1) Can the Startup Options be set from VBA? The documentation appears to say so but provides no examples. I'm trying to use a VBA SUB to prpare the DB for use by others without access to menus and starting with a specific screen. I'd rather not access the menu pull down each time
You need to create some DAO properties for the database that represent the options you want to control. The properties exist but you still may need to create them?!. Check the help for things like 'AllowFullMenus' etc.
Here's a snippet to get you started
Dim prp As DAO.Property
Dim db As DAO.Database
Dim iAllowOption As Integer
Set db = CurrentDb
'lock StartupShowDBWindow option
iAllowOption = 1 'Set it to the value where no StartupShowDBWindow is found
'See if the property exists
For Each prp In db.Properties
If prp.Name = "StartupShowDBWindow" Then
iAllowOption = prp.Value 'False=0, True=-1
Exit For
End If
Next
If iAllowOption = 1 Then
'No 'StartupShowDBWindow' property found
'Create it and set to false
Set prp = CurrentDb.CreateProperty("StartupShowDBWindow", dbBoolean, True, True)
db.Properties.Append prp
db.Properties.Refresh
Set prp = Nothing
Set db = Nothing
Call LockDatabase
End If
prp.Value = False
'lock ByPass Key option
iAllowOption = 1 'Set it to the value where no AllowBypassKey is found
'See if the property exists
For Each prp In db.Properties
If prp.Name = "AllowBypassKey" Then
iAllowOption = prp.Value 'False=0, True=-1
Exit For
End If
Next
If iAllowOption = 1 Then
'No 'AllowBypassKey' property found
'Create it and set to false
Set prp = CurrentDb.CreateProperty("AllowBypassKey", dbBoolean, True, True)
db.Properties.Append prp
db.Properties.Refresh
Set prp = Nothing
Set db = Nothing
Call LockDatabase
End If
prp.Value = False
by stevenmatuszak Accepted solution
This discussion is closed to new replies.
Trending Software posts
Sort by Trending