Function Set Properties() MS Access

Function Set Properties()

Put these three functions in the Module of Access

1) Function SetProperties()
Public Function SetProperties(PropName As String, PropType As Variant, PropValue As Variant) As Integer
On Error GoTo Err_SetProperties
   Dim db As Database, prop As Property
   'Dim db As DAO.Database, prop As DAO.Property (use in the old version prior 2007)
   Set db = CurrentDb
   db.Properties(PropName) = PropValue
   SetProperties = True
   Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
   If Err = 3270 Then 'case of property not found
       Set prop = db.CreateProperty(PropName, PropType, PropValue)
       db.Properties.Append prop
       Resume Next
   Else
       SetProperties = False
       MsgBox "Runtime Error # " & Err.number & vbCrLf & vbLf & Err.Description
       Resume Exit_SetProperties
   End If
End Function

‘*************************************

2) Function DisableProperties()
Public Function DisableProperties()
On Error GoTo TheError
DoCmd.ShowToolbar "Ribbon", acToolbarNo
‘Disable properties listed below by setting the property value to False
SetProperties "StartUpShowDBWindow", dbBoolean, False
SetProperties "StartUpShowStatusBar", dbBoolean, False
SetProperties "AllowFullMenus", dbBoolean, False
SetProperties "AllowSpecialKeys", dbBoolean, False
SetProperties "AllowBypassKey", dbBoolean, False
SetProperties "AllowShortcutMenus", dbBoolean, False
SetProperties "AllowToolbarChanges", dbBoolean, False
SetProperties "AllowBreakIntoCode", dbBoolean, False
Exit Function
TheError:
MsgBox Err.Description
Exit Function
End Function

‘************************************
affiliate_link
3) Function EnableProperties()

Public Function EnableProperties()
On Error GoTo ErrorHandler:
DoCmd.ShowToolbar "Ribbon", acToolbarYes
‘Set all properties listed below back to normal by setting value to True
'Show Database window
SetProperties "StartUpShowDBWindow", dbBoolean, True
SetProperties "StartUpShowStatusBar", dbBoolean, True
'show Access Full Menus.
SetProperties "AllowFullMenus", dbBoolean, True
'enable F11, ALT F11, etc. for short key
SetProperties "AllowSpecialKeys", dbBoolean, True
'Shift Key Override on loading
SetProperties "AllowBypassKey", dbBoolean, True
'allow Access Shortcut Menus. May be too severe
SetProperties "AllowShortcutMenus", dbBoolean, True
SetProperties "AllowToolbarChanges", dbBoolean, True
SetProperties "AllowBreakIntoCode", dbBoolean, True
Exit Function
ErrorHandler:
MsgBox Err.Description
Exit Function
End Function

************************************************

Use of Function

Call DisableProperties() under the On Load Event Procedure of the Navigation Form or Main Form that first loaded when open program.

Call EnableProperties() function under the click button anywhere in the form in order to allow the developer to update the VBA or program design.

The major reason behind happening of erotic disorder is the condition in which men are not able to have proper erections order viagra online in the bed. These drugs work well for people generic cialis online of all ages. The standard dose of cheap viagra for sale is 50 mg, other this the doctor may change the potency according to the patients that aids in making things better. We don t have any of the products that are very much effective to heal the every disease from the root, and they have to suffer the disease later in their life. order discount viagra affiliate_link

Related posts