Database object properties (StartupShowDBWindow)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    Database object properties (StartupShowDBWindow)

    In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWi ndow appropriately.

    I tried this

    [Code=vb]Private Sub Btn_Quit_Click( )
    Dim NAdb As DAO.Database
    Set NAdb = CurrentDb

    On Error GoTo Err_Btn_Quit_Cl ick

    If Me.chkToggleSta te.Value = False Then
    NAdb.Properties .StartUpShowDBW indow.Value = False
    Else
    NAdb.Properties .StartUpShowDBW indow.Value = True
    End If

    DoCmd.Quit

    Exit_Btn_Quit_C lick:
    Exit Sub

    Err_Btn_Quit_Cl ick:
    MsgBox Err.Description
    Resume Exit_Btn_Quit_C lick

    End Sub
    [/Code]

    but get a "Method not found" error with the StartupShowDBWi ndow highlighted.

    The property has been set and unset from <Tools> <Startup> Display database window and the application restarted so I shouldn't have to create the property.

    Probably something silly but it's escaping me.

    Thanks in advance

    Jim
  • BradHodge
    Recognized Expert New Member
    • Apr 2007
    • 166

    #2
    In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWi ndow appropriately.
    Just a suggestion Jim, but why not set the toggle button back to false on Quit (or on close of your main form). That way, you always know where it is going to be when the database opens and you don't have to check it's state.

    Brad.

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      Originally posted by JustJim
      In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWi ndow appropriately.

      I tried this

      [Code=vb]Private Sub Btn_Quit_Click( )
      Dim NAdb As DAO.Database
      Set NAdb = CurrentDb

      On Error GoTo Err_Btn_Quit_Cl ick

      If Me.chkToggleSta te.Value = False Then
      NAdb.Properties .StartUpShowDBW indow.Value = False
      Else
      NAdb.Properties .StartUpShowDBW indow.Value = True
      End If

      DoCmd.Quit

      Exit_Btn_Quit_C lick:
      Exit Sub

      Err_Btn_Quit_Cl ick:
      MsgBox Err.Description
      Resume Exit_Btn_Quit_C lick

      End Sub
      [/Code]

      but get a "Method not found" error with the StartupShowDBWi ndow highlighted.

      The property has been set and unset from <Tools> <Startup> Display database window and the application restarted so I shouldn't have to create the property.

      Probably something silly but it's escaping me.

      Thanks in advance

      Jim
      Hi, Jim.

      Property is a member of Properties collection. To get it you should use "!" operator instead of "." .
      Code:
      CurrentDB.Properties!StartupShowDBWindow.Value = ...

      Comment

      • JustJim
        Recognized Expert Contributor
        • May 2007
        • 407

        #4
        Originally posted by BradHodge
        Just a suggestion Jim, but why not set the toggle button back to false on Quit (or on close of your main form). That way, you always know where it is going to be when the database opens and you don't have to check it's state.

        Brad.
        Hmm worth a think. I'm going to have to change all my exit buttons to link them to one form so that I can do an "applicatio n on close" event. May just take your advice if there is no other specific help forthcoming.

        Thanks

        Jim

        Comment

        • JustJim
          Recognized Expert Contributor
          • May 2007
          • 407

          #5
          Originally posted by FishVal
          Hi, Jim.

          Property is a member of Properties collection. To get it you should use "!" operator instead of "." .
          Code:
          CurrentDB.Properties!StartupShowDBWindow.Value = ...
          Thank you. I knew it would be silly (of me, I'm always "banging" when I should be "dotting" and vice versa)

          Jim

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by JustJim
            Thank you. I knew it would be silly (of me, I'm always "banging" when I should be "dotting" and vice versa)

            Jim
            There are basically 2 acceptable Method to Set/Retrieve Dynamic Properties contained within a Properties Collection:
            [CODE=vb]'By Property Name (preferred)
            CurrentDb.Prope rties("StartUpS howDBWindow")[/CODE]
            [CODE=vb]'By Ordinal Position within the Collection
            CurrentDb.Prope rties(25).Name[/CODE]

            NOTE: Although the Bang Operator will yield the same results and also save you a bit of typing, you'll pay for it with a speed penalty. Behind the scenes, the Bang Reference is translated to the Parentheses-and-Quotes format for referring to an Item within a Collection. The usual recommendation is to always use the later format for referring to a Member of a Collection unless it is absolutely necessary to use the Bang Operator. One place the Bang Operator is necessary is Query Parameters that refer to Form Fields as in: Forms!FormName! ControlName. In virtually all other instances avoid the Bang and stay with Quotes!

            Comment

            • JustJim
              Recognized Expert Contributor
              • May 2007
              • 407

              #7
              Originally posted by ADezii
              ...... In virtually all other instances avoid the Bang and stay with Quotes!
              Thank you for that. A major problem with being self-taught is that you don't get these basics stuck in your head properly.

              Had a laugh at the exclamation mark/point (bang) at the end of your advice to avoid the suckers though.

              Jim

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                Originally posted by JustJim
                Thank you for that. A major problem with being self-taught is that you don't get these basics stuck in your head properly.

                Had a laugh at the exclamation mark/point (bang) at the end of your advice to avoid the suckers though.

                Jim
                It's critical that you maintain your sense of humor in this business, because things can get a littly 'dry' at times. Take care.

                Comment

                Working...