Results 1 to 3 of 3

Thread: Restore Menus

  1. #1
    Join Date
    Jan 2006
    Posts
    54

    Unanswered: Restore Menus

    I have a DB which opens directly into a form

    I have a hidden button which will show the Dbwindow, but this doesn't restore the menus which were disabled in the startup option.

    Is there a way to enable all menus (via VBA) when already in the database?

    I've seen code which can change the Startup properties but that is only good when starting the db, not when you're already in it.

    Is this possible or am I stuck?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try doing a function called ChangeProperty for example

    PHP Code:
    Function ChangeProperty(PropName As StringPropTyp As VariantPropVal As Variant) As Integer
      
    ' Call:Call ChangeProperty("AllowBuiltinToolbars", dbBoolean, False)  

      
      Dim db As Database, prp As Property
      Const conPropNotFoundError = 3270
     
      On Error GoTo ERR_ChangeProperty
       Set db = CurrentDb
       db.Properties(PropName) = PropVal
       ChangeProperty = True
      

    EXIT_ChangeProperty:
      Set db = Nothing
      If Not prp Is Nothing Then Set prp = Nothing
       Exit Function
       
    ERR_ChangeProperty:
      If Err = conPropNotFoundError Then
        Set prp = db.CreateProperty(PropName, PropTyp, PropVal)
        db.Properties.Append prp
        Resume Next
      Else                        ' 
    Unknown given property
        ChangeProperty 
    False
        Resume EXIT_ChangeProperty
      End 
    If
    End Function 

    then call it from the immediate box as

    ChangeProperty("AllowBuiltinToolbars", dbBoolean, True)

  3. #3
    Join Date
    Jan 2006
    Posts
    54
    It was the changeProperty function I was referring to in my post.

    This only works on a db restart - not while you are in it.

    Michael.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •