I am experimenting with locking down an MS Access DB and have successfully locked down a database, but I can not figure out how to allow developers to open the DB if necessary.
Here is code I used to secure DB.. Along with changing options in StartUp. I unChecked all Allow options and Unchecked Access Special Keys. Now, I appear to be locked out.
Private Sub Form_Load()
'call from startup object - Main Menu Form
Call SecureDatabase
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarNo
End Sub
Private Sub SecureDatabase()
Dim dbsCurrent As DAO.Database
Set dbsCurrent = CurrentDb
' set executable properties.
'set TRUE to enable...
ChangeProperty dbsCurrent, "AllowBreakIntoCode", dbBoolean, False
ChangeProperty dbsCurrent, "AllowBuiltinToolbars", dbBoolean, False
' AllowBypassKey commented out until needed.
ChangeProperty dbsCurrent, "AllowBypassKey", dbBoolean, False
ChangeProperty dbsCurrent, "AllowFullMenus", dbBoolean, False
ChangeProperty dbsCurrent, "AllowSpecialKeys", dbBoolean, False
ChangeProperty dbsCurrent, "StartupShowDBWindow", dbBoolean, False
Set dbsCurrent = Nothing
DoCmd.Restore
End Sub
Private Sub ChangeProperty(dbsCurrent As DAO.Database, strPropertyName As String, varPropertyType As Variant, bolPropertyValue As Boolean)
On Error GoTo SubErr
dbsCurrent.Properties(strPropertyName) = bolPropertyValue
SubExit:
Exit Sub
SubErr:
' if property not found, create it
If Err = 3270 Then
Dim prpNew As DAO.Property
Set prpNew = dbsCurrent.CreateProperty(strPropertyName, 1, bolPropertyValue, True)
dbsCurrent.Properties.Append prpNew
Else
MsgBox Err.Description, vbCritical
End If
End Sub
tia,
Steve Medvid
"IT Consultant & Web Master"
Chester County, PA Residents
Please Show Your Support...
Here is code I used to secure DB.. Along with changing options in StartUp. I unChecked all Allow options and Unchecked Access Special Keys. Now, I appear to be locked out.
Private Sub Form_Load()
'call from startup object - Main Menu Form
Call SecureDatabase
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarNo
End Sub
Private Sub SecureDatabase()
Dim dbsCurrent As DAO.Database
Set dbsCurrent = CurrentDb
' set executable properties.
'set TRUE to enable...
ChangeProperty dbsCurrent, "AllowBreakIntoCode", dbBoolean, False
ChangeProperty dbsCurrent, "AllowBuiltinToolbars", dbBoolean, False
' AllowBypassKey commented out until needed.
ChangeProperty dbsCurrent, "AllowBypassKey", dbBoolean, False
ChangeProperty dbsCurrent, "AllowFullMenus", dbBoolean, False
ChangeProperty dbsCurrent, "AllowSpecialKeys", dbBoolean, False
ChangeProperty dbsCurrent, "StartupShowDBWindow", dbBoolean, False
Set dbsCurrent = Nothing
DoCmd.Restore
End Sub
Private Sub ChangeProperty(dbsCurrent As DAO.Database, strPropertyName As String, varPropertyType As Variant, bolPropertyValue As Boolean)
On Error GoTo SubErr
dbsCurrent.Properties(strPropertyName) = bolPropertyValue
SubExit:
Exit Sub
SubErr:
' if property not found, create it
If Err = 3270 Then
Dim prpNew As DAO.Property
Set prpNew = dbsCurrent.CreateProperty(strPropertyName, 1, bolPropertyValue, True)
dbsCurrent.Properties.Append prpNew
Else
MsgBox Err.Description, vbCritical
End If
End Sub
tia,
Steve Medvid
"IT Consultant & Web Master"
Chester County, PA Residents
Please Show Your Support...