Question

Locked

Microsoft Access 2003 VBA Access to Startup Settings

By stevenmatuszak ·
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.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Access Startup Settings

by EricRae In reply to Microsoft Access 2003 VBA ...

>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

Collapse -

Thanks!

by stevenmatuszak In reply to Access Startup Settings

Thanks for your time. That's exactly what I needed to know.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums