P
Programmer - wannaB
First let me send my thanks out to Pieter who has helped me a great deal on
something else but that help has allowed me to get to this point, and
Wolfgang who directed me to an MSDN site where I found the rest of what I
needed for this one.
Thanks to you all..
I have written the code below to run as a toggle from a command button and
everything seems to work fine except displaying the changes to the properties
of the commandbutton. Specifically the transparent property. The button
should be transparent when the StartUp Options are set to secure the DB, and
visible when the DB is unsecured. I expect that it has something to do with
the ability or inability to save the form, and If I am correct how can I tell
it to save the form before closing?
I would appreciate any and all comments regarding the code that I’ve written
and how it could be done better.
Private Sub ToggleStartUpOptions_Click()
Dim dbs As Object
Const PROPERTY_NOT_FOUND As Integer = 3270
Const ITEM_NOT_IN_COLLECTION As Integer = 3265
Const TEXT_TYPE As Integer = 10 'Equivalent to DAO dbText data type.
Const BOOL_TYPE As Integer = 1 'Equivalent to DAO dbBoolean data type.
Const LONG_TYPE As Integer = 4 'Equivalent to DAO dbLong data type.
Set dbs = Application.CurrentDb
OpenStartUpProperties:
On Error GoTo ErrorHandler
If Me!ToggleStartUpOptions.Caption = "." Then
Me!ToggleStartUpOptions.Caption = "OFF"
Me!ToggleStartUpOptions.Transparent = False
dbs.Properties("AllowFullMenus") = True
MsgBox "AllowFullMenu setting is > " &
dbs.Properties("AllowFullMenus").Value
dbs.Properties("AllowShortcutMenus") = True
dbs.Properties("StartupShowDBWindow") = True
dbs.Properties("AllowSpecialKeys") = True
dbs.Properties("AllowBuiltInToolBars") = True
dbs.Properties("AllowToolbarChanges") = True
dbs.Properties("AllowBypassKey") = True
Else
Me!ToggleStartUpOptions.Caption = "."
Me!ToggleStartUpOptions.Transparent = True
dbs.Properties("AllowFullMenus") = False
MsgBox "AllowFullMenu setting is > " &
dbs.Properties("AllowFullMenus").Value
dbs.Properties("AllowShortcutMenus") = False
dbs.Properties("StartupShowDBWindow") = False
' dbs.Properties("AllowSpecialKeys") = False
dbs.Properties("AllowBuiltInToolbars") = False
dbs.Properties("AllowToolbarChanges") = False
dbs.Properties("AllowBypassKey") = False
End If
ExitLine:
On Error Resume Next
dbs.Close
Set dbs = Nothing
Exit Sub
ErrorHandler:
MsgBox "ERROR#>> " & Err.Number & " --DESCRIPTION>> " & Err.Description
Resume Next
End Sub
something else but that help has allowed me to get to this point, and
Wolfgang who directed me to an MSDN site where I found the rest of what I
needed for this one.
Thanks to you all..
I have written the code below to run as a toggle from a command button and
everything seems to work fine except displaying the changes to the properties
of the commandbutton. Specifically the transparent property. The button
should be transparent when the StartUp Options are set to secure the DB, and
visible when the DB is unsecured. I expect that it has something to do with
the ability or inability to save the form, and If I am correct how can I tell
it to save the form before closing?
I would appreciate any and all comments regarding the code that I’ve written
and how it could be done better.
Private Sub ToggleStartUpOptions_Click()
Dim dbs As Object
Const PROPERTY_NOT_FOUND As Integer = 3270
Const ITEM_NOT_IN_COLLECTION As Integer = 3265
Const TEXT_TYPE As Integer = 10 'Equivalent to DAO dbText data type.
Const BOOL_TYPE As Integer = 1 'Equivalent to DAO dbBoolean data type.
Const LONG_TYPE As Integer = 4 'Equivalent to DAO dbLong data type.
Set dbs = Application.CurrentDb
OpenStartUpProperties:
On Error GoTo ErrorHandler
If Me!ToggleStartUpOptions.Caption = "." Then
Me!ToggleStartUpOptions.Caption = "OFF"
Me!ToggleStartUpOptions.Transparent = False
dbs.Properties("AllowFullMenus") = True
MsgBox "AllowFullMenu setting is > " &
dbs.Properties("AllowFullMenus").Value
dbs.Properties("AllowShortcutMenus") = True
dbs.Properties("StartupShowDBWindow") = True
dbs.Properties("AllowSpecialKeys") = True
dbs.Properties("AllowBuiltInToolBars") = True
dbs.Properties("AllowToolbarChanges") = True
dbs.Properties("AllowBypassKey") = True
Else
Me!ToggleStartUpOptions.Caption = "."
Me!ToggleStartUpOptions.Transparent = True
dbs.Properties("AllowFullMenus") = False
MsgBox "AllowFullMenu setting is > " &
dbs.Properties("AllowFullMenus").Value
dbs.Properties("AllowShortcutMenus") = False
dbs.Properties("StartupShowDBWindow") = False
' dbs.Properties("AllowSpecialKeys") = False
dbs.Properties("AllowBuiltInToolbars") = False
dbs.Properties("AllowToolbarChanges") = False
dbs.Properties("AllowBypassKey") = False
End If
ExitLine:
On Error Resume Next
dbs.Close
Set dbs = Nothing
Exit Sub
ErrorHandler:
MsgBox "ERROR#>> " & Err.Number & " --DESCRIPTION>> " & Err.Description
Resume Next
End Sub