Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Feb 2009
    Location
    Burlington, Ontario, Canada
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Referencing Tabs in an Access Form (Access 2003)

    Hi,

    I have a created a bit of a monster form with a mess of subforms and am having trouble passing data around. Here are the specifics:

    I have a tab control (BudgetTab) that has a subform on each tab. The first tab is a Continuous Form that outlines budget data that the user selects. This needs to feed into the second tab which has a treeview on it. The nodes are sub-budget elements that are linked by the BudgetID selected on the first tab.

    So here is the challenge. When I select an item in the subform on tab 1, I need to invoke a function on the second tab that will regenerate the tree. For the life if me, I have not been able to figure out how to directly call a function in the subform on tab 2 from subform on tab 1.

    Any Suggestions? Thanks in advance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Referencing Tabs in an Access Form (Access 2003)

    Welcome to Woody's Lounge!

    If the function you want to call is defined in the subform on the second tab, it should be declared as Public. You can then call it like this from the subform on the first tab:

    Call Me.Parent.NameOfSecondSubform.Form.NameOfFunction

    where NameOfSecondSubform must be the name of the second subform as a control on the main form; this is not necessarily the same as the name of the second subform in the database window.
    And NameOfFunction must be the name of the function.

  3. #3
    New Lounger
    Join Date
    Feb 2009
    Location
    Burlington, Ontario, Canada
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing Tabs in an Access Form (Access 2003)

    Hi Hans.

    Thanks for the quick response and the welcome. After many attempts and different variations, I was not able to get this to work in any way shape or form. Here is the list the forms/subforms I have with the names being those I assigned in the "Names" field in the property box.



    Main Form: Budget
    Tab Control: BudgetTab
    Tab 1: BudgetSelection
    Tab 1 subform: subBudgetSelector - This is the subform I am calling from

    Tab 2: GroupTree
    Tab 2 subform: GroupTreeView
    Function: RefreshTree_Click - And here is the function I am trying to call (it is public)

    I have tried

    Call Me.Budget.GroupTree.Form.RefreshTree_Click
    Call Me. Budget.GroupTreeView.Form.RefreshTree_Click
    Call Me.BudgetTab.GroupTree.Form.RefreshTree_Click
    Call Me.BudgetTab.GroupTreeView.Form.RefreshTree_Click
    Call Form.Budget.GroupTreeView.Form.RefreshTree_Click

    and so on.

    Every time, I get the same error: "Method or data member not found" and the de###### points to the first entry after Me., identified as .Parent. in your response.

    Any thoughts?

    Cheers,
    Angus

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Referencing Tabs in an Access Form (Access 2003)

    Instead of Me.Budget, use Me.Parent.

    "Parent" is a keyword - on a subform, Parent refers to the main form.

  5. #5
    New Lounger
    Join Date
    Feb 2009
    Location
    Burlington, Ontario, Canada
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing Tabs in an Access Form (Access 2003)

    Duh ... feeling a little silly for missing the keyword thing.

    Thanks so much, this worked and has put an end to many nights of surfing, investigating and testing.

    Cheers,
    Angus

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Referencing Tabs in an Access Form (Access 2003)

    See Forms: Refer to Form and Subform properties and controls for a comprehensive overview of how to refer to subforms etc.

Posting Permissions

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