Refreshing a Tabbed subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saltmarsh
    New Member
    • Sep 2015
    • 6

    Refreshing a Tabbed subform

    Hi,

    I have a Form that has a navigation subform (Horizontal tabs) which in turn has a navigation subform (vertical tabs) which in turn has a subform for use when that tab is selected. On that subform is another subform (based on a query)that lists accounts based on an as of date. The query uses the As of Date that is on the Base form when opened. The As of Date comes from another form where it is selected prior to opening frmBase. When the form (frmBase) opens (it is the first to appear), the subform is blank. However, when I select another tab and then return to it, the data appears. The forms are named:

    frmBase - Holds the navigation form and the As of Date
    NavigationSubfo rm - Horizontal tabs for subforms
    sfrmTOHBase - located on a vertical tab
    sfrmList - located on the sfrmTOHBase

    Interestingly, when looking at it in Expression builder it appears as Forms![frmBase]![NavigationSubfo rm].Form![sfrmList]. It seems to skip over sfrmTOHBase.

    So, in short, I'd like the results in sfrmList to appear when the form opens. Any help would be greatly appreciated as this has me stumped.

    Thanks in advance.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    +The Navigation control introduced in ACC2010 is not a tabbed form.

    +The "Tabs" as you call them are actually a specially grouped set of command buttons.

    + Each time you click on one of these buttons, the form associated with that button is loaded, new, fresh, reloaded. Any information that was previously contained in that form is either saved to the bound table, or lost.

    What that means is that if, for example, the first button on the vertical set is clicked, entry is made in the controls on that form, then the third button on the horizontal row is clicked (or any button, including the originally selected button!), the values in the first form are either saved to the record or they are lost when the new form is loaded.

    Now, you have a few options to pass information between forms:

    - From a bound control, refer to the table... this of course supposes that the newly loaded form has a method of determining the correct record and field.
    - Local variables (local to the parent form)
    - Global variables
    - Tempvars collection (which is growing on me)
    - DoCmd.Browseto method

    IN all but the last case, one has to use a On Load or On Open event and code to determine the passed value and act accordingly.

    The last case, DoCmd.Browseto method, can be used to pass a WhereCondition to the form that is being "browsed to" that filters the form's bound recordset.

    For a bit more information about the NavigationFormC ontrol see my post here: https://bytes.com/topic/access/answe...s#post3760995"
    -- I am working on an insights article based on this very post :)

    + There is also a known bug in the navigation control that if the control group uses more than one set of command buttons and the parent form has VBA associated with it that the form will crash when opened using a split front-end/back-end database.
    Last edited by zmbd; Nov 9 '15, 08:20 PM.

    Comment

    • saltmarsh
      New Member
      • Sep 2015
      • 6

      #3
      Thank you. That's helpful information. I had no idea that the navigation subform is a set of grouped buttons. It has helped put me on a better path for the answer.

      However, I'm still lost on how to get the data on the first form to appear without having to first click on another tab and then return to the first one. What you provided did help me search further but I have to admit I'm somewhat of a novice on the VBA side.

      Any further guidance that you could provide would be deeply appreciated.

      Thank you.

      Comment

      • saltmarsh
        New Member
        • Sep 2015
        • 6

        #4
        ZMBD, the information that you provided on the Navigation Control was extremely helpful. I was looking in the wrong places. Thank you.

        I used that as a jumping off point to dig deeper and am finding that there doesn't appear to be an easy (or apparent) solution to having the first form appear with data on the Navigation Control.

        So in the interest of helping others with the same issue, as a temporary solution, I took the easy way and just created a message form to come up on the first tab explaining to users how to select data. The remaining tabs display the data when selected as they should.

        Not the best solution, but to a user, it's better than having a blank form appear. And in the mean time I'll keep on looking.

        Thanks again.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Q1) Ok, re-reading your post, is the following correct:
          + Parent form with NavigationFormC ontrol named FrmBase with horizontal navigation buttons. Therein also resides a control named [AsOfDate]

          + Child form with NavigationFormC ontrol named ??? with vertical navigation buttons
          this would be a second form with a second NavigationFormC ontrol not the NavigationFormC ontrol formatted to have two sets of navigation buttons created by: Ribbon>Create>F orms>Navigation _Menu>{Horizont al Tabs and Vertical Tabs (Left/Right)}

          + GrandChild form assigned to load when the Child form's vertical navigation button is clicked on.

          You have a query along the following lines - that is the record source for the grandchild:
          Code:
          SELECT [PK], [Field_Date]
          FROM [DataTable]
          WHERE ( [DataTable]![Field_Date] =
             [Forms]![FrmBase]![AsOfDate]);
          So when you click on the vertical button of the Child form you wish for the Grandchild to load the current record set based on the query returning only those records with the matching date as entered in the [AsOfDate] control on the parent.

          There is no On_load or On_Open VBA nor Macro code in the GrandChild form that would clear a filter or other such actions in any of the other forms related to, or acting on, this subform.

          Q2) With all tables, forms, reports, and other queries closed, open the Grandchild form, what happens?

          Q3) With all tables, forms, reports, and other queries closed, open the query that is the record source for the Grandchild, what happens?

          Q4) With all tables, forms, reports, and other queries closed, Open the parent form in design mode. Show the properties for the vertical tab on the Child Navigation, or that the tab that is designated to open the Grandchild.
          • In the data-tab what are the values for the following properties
            Q4a) Navigation Target Name
            Q4b) Navigation Where Clause
            Q4c) Enabled
          • In the All-Tab
            Q4d) Name
          • In the Event-Tab
            Q4e)any entries for any property
          Last edited by zmbd; Nov 10 '15, 09:17 PM.

          Comment

          Working...