Reset Access (1 Viewer)

Guus2005

AWF VIP
Local time
Today, 01:03
Joined
Jun 26, 2007
Messages
2,645
In Access 2010 the button for the form property sheet wasn't working, double clicking the form didn't trigger the property sheet either and above all, the context menu (right-click) didn't respond.

Following code resets every commandbar/menu/properties/... in this version of Access.

I am not sure how the code will respond in different versions.

Let me know what you think.

Share & Anjoy!

Code:
Public Sub ResetAccess()
 
    Dim i As Integer
    
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
    
    For i = 1 To CommandBars.Count
       CommandBars(i).Enabled = True
    Next i
    
    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True
  
    MsgBox "All properties reset"
    
End Sub

Private Function ChangeProperty(prpName As String, prpType As Variant, prpValue As Variant) As Integer
'Usage: ChangeProperty("AppTitle", dbText, "ESS History")

   Dim db As DAO.Database, PRP As DAO.Property, ws As Workspace
   Const ERROR_PROPNOTFOUND = 3270

   Set db = CurrentDb()

   ' Set the startup property value.
   On Error GoTo Err_ChangeProperty
   db.Properties(prpName) = prpValue
   ChangeProperty = True

Bye_ChangeProperty:
   Exit Function

Err_ChangeProperty:
   Select Case Err
   ' If the property does not exist, create it and try again.
   Case ERROR_PROPNOTFOUND
      Set PRP = db.CreateProperty(prpName, prpType, prpValue)
      db.Properties.Append PRP
      Resume
   Case Else
      ChangeProperty = False
      Resume Bye_ChangeProperty
   End Select
End Function
 

Users who are viewing this thread

Top Bottom