Za zakljucavanje MDB
Function LockStartup() As Boolean
On Error GoTo LockStartup_Error
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowToolbarChanges", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
ChangeProperty "AllowBypassKey", DB_Boolean, False
Exit_:
Exit Function
LockStartup_Error:
msgbox err.Description
Resume Exit_
End Function
Za otkucavanje MDB
Function UnlockStartup() As Boolean
On Error GoTo UnlockStartup_Error
ChangeProperty "StartUpForm", vbVariant, "(none)"
ChangeProperty "StartupMenuBar", vbString, "(default)"
ChangeProperty "StartupShowDBWindow", DB_Boolean, True
ChangeProperty "StartupShowStatusBar", DB_Boolean, True
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowToolbarChanges", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
Exit_:
Exit Function
UnlockStartup_Error:
msgbox err.Description
Resume Exit_
End Function
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If err = conPropNotFoundError Then
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Resume Change_Bye
End If
End Function
|