Some issues with using PathToSubformControl (1 Viewer)

ZikO

Registered User.
Local time
Today, 04:06
Joined
Dec 15, 2012
Messages
41
Hello,

I am having some issues with displaying a subform within a navigation form. please, could someone help me to understand the BrowseTo macro? There is the PathToSubformControl argument which I cannot really understand. Perhaps it is because I did not understand a structure of forms, subforms, subform controls etc.

I have a Form called "frm_navigation" that consists of Navigation Tabs. This form contains two subforms frm_vacancies and frm_organizations that are assigned to tables tbl_vacancies and tbl_organizations, respectively.

In the tab "Vacancies" and the subform "frm_vacancies", there is a field "Organization name" that displays an assigned name of an organization which is related to a vacancy. The name is taken from the other table tbl_organizations. I would like to program a button that would display / focus the "Organization" tab with a record related to current organization id.

So far I did it via DoCmd.OpenForm but it filters out all other records and opens a new window. I tried to set BrowseTo action as follows:

Code:
DoCmd.BrowseTo acBrowseToForm, "frm_Organizations", "frm_navigation.nav_organizations", "[tbl_organizations].[PR_ID]=" & Me.cb_org_name.Value

but I've got runtime error as my PathToSubformControl is wrong. How am I supposed to specify the path? I cannot understand the structure. It's supposed to follow this pattern: MainForm1.Subform1 > Form1.Subform1 but it's not really explained well on office.com to be frank.

I hope I managed to give you a clear idea what I am trying to achieve.

Thanks

PS> It may help if I provide names of Tabs in Navigation Form which are following: nav_vacanies and nav_organizations

Attachment:
I cannot include pictures yet so please find the screenshot under this link
zebik.republika.pl/frm_navigation.jpg
 

ZikO

Registered User.
Local time
Today, 04:06
Joined
Dec 15, 2012
Messages
41
Hi,
It's me again. I think I have finally understood how to refer to Subform Control in VBA but my code did not work anyway. I decided to build a macro that looks like below:

Code:
BrowseTo:
                Object Type: Form
                Objact Name: frm_Organizations
    Path To Subform Control: frm_navigation.NavigationSubform
            Where Condition: [tbl_organizations].[PR_ID]=[Forms]![frm_navigation]![NavigationSubform].[Form]![cb_org_name].[ControlSource]

For some reason, it only jump to proper Tab (Organizations) but it does not display anything--it is just a blank Subform Control without any form in it. I don't know what I am doing wrong here. I would be really grateful for any clues on that.
Possible problems may be with Where Condition. tbl_organizations contains all organizations. The button I click is in frm_vacancies that visualizes tbl_vacancies. I am not sure if the expression:
Code:
[tbl_organizations].[PR_ID]=[Forms]![frm_navigation]![NavigationSubform].[Form]![cb_org_name].[ControlSource]
is correct here though. Perhaps someone can see the obvious problem I am missing here.

Cheers!
 

Users who are viewing this thread

Top Bottom