How to specify PathToSubformControl for BrowseTo in access 2010

末鹿安然 提交于 2020-07-23 08:30:08

问题


Could someone help me with BrowseTo macro plsease? I cannot figure out one of the arguments in the this macro in ACCESS 2010 which is PathToSubformControl. I have this Form called "frm_navigation": enter image description here

The names of all Tab are: nav_vacancies, nav_contacts, nav_organizations etc. The field "Organization name" in the figure will hold the name from another table tbl_organizations. However, the Tab "Organizations" (the third from left) will display all info from the table tbl_organizations.

I would like to program a button that takes me to Organization Tab and set a current record according to the name displayed in the field "Organizations name".

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:

    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 explained what is what.

Thanks


回答1:


Very late reply, but...

In your code, "frm_navigation.nav_organizations" needs to specify the name of the NavigationSubForm subform control (by default it is NavigationSubForm).

Let me try to re-state your command with generic names:

DoCmd.BrowseTo acBrowseToForm, "frmToDisplayInNavSubCtl", "frmMainFormContainingNavSubFrmCtl.NavSubFrmCtl", ....criteria....

So, in short, you need to go into design view on your frm_navigation form and determine the name of the NavigationSubForm control, not the names of the navigation buttons (e.g., nav_organizations, nav_vacancies, etc.) and use that after the dot, instead of .nav_organizations (the name of the button control).



来源:https://stackoverflow.com/questions/13884021/how-to-specify-pathtosubformcontrol-for-browseto-in-access-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!