在导航中打开子表单(ELI5) [英] Opening subform within navigations (ELI5)
问题描述
我有一个正在构建的访问数据库(我偶尔发布过我的问题),并且我对ms访问有一个一般性的疑问:
I have an access database I'm building (i've posted occasionally with my questions) and I have a general question about ms access:
如何在导航表单中打开子表单?
How do you open a subform within a navigation form?
我有一个主树/子树:
Main Navigation Form
-> Main Student Records Navigation Form
-> View All Students Datasheet
-> View Edit Student
Main Navigation Form
-> Main Student Records Navigation Form
-> View All Students Datasheet
-> View Edit Student
我的目标是单击数据表中记录的ID,然后打开显示完整详细信息的查看/编辑学生"(数据表中仅包含几个元素).
My goal is to click on the ID of a record in the datasheet, and have it open the "view/edit student" that displays the full details (the datasheet only has a few elements to it).
但是,老实说,我不明白如何调用子窗体以这种方式打开.我已经读过它了,我想应该是这样的
But I honestly don't understand how to call a subform to open like that. I've read about it, and I thought it'd be something like
DoCmd.OpenForm Forms!NavigationForm.StudentNav_Form.ViewEditStud_Form
但这不起作用.但是我觉得这个问题对访问的工作方式来说是系统的.我不确定我是否了解在VBA中引用和调用对象的工作方式.阅读msdn文章只会使我更加困惑>.<
But this doesn't work. But this problem I'm having I feel like is systemic to the way access works. I'm not sure I understand how referencing and calling objects within VBA works. Reading the msdn articles is only confusing me more >.<
谢谢!
我发现了:导航到一个导航子表单中的其他选项卡
BrowseTo
命令似乎是我想要的,但是我不确定我是否知道如何编写语法以移至正确的页面...我将进行实验,但是如果有人有我的想法, d想知道!
The BrowseTo
command seems like what I want, but I'm not sure I understand how to write the syntax to move to the right page... I'm going to experiment but if anyone has any idea I'd love to know!
推荐答案
我已经解决了.我不想要DoCmd.Open
我想要DoCmd.Browseto
,如上面的文章中所述.浏览的语法如下所示:
I've solved it. I didn't want DoCmd.Open
I wanted DoCmd.Browseto
as described in the post above. The syntax for the browse to looks like:
DoCmd.BrowseTo acBrowseToForm, "ViewEditStud_Form", "NavigationForm.NavigationSubform>StudentNav_Form.NavigationSubform"
花了我一段时间才能理解这一点,所以我将其分解.
It took me a while to understand this so I'm going to break it down.
acBrowseToForm
告诉我我正在浏览表单(显然!)
"ViewEditStud_Form"
是我要浏览的表单.
"NavigationForm.NavigationSubform>StudentNav_Form.NavigationSubform"
是在何处打开的说明. NavigationForm
是我的主导航表单的名称. .NavigationSubform>
标识有一个子窗体可在其中打开它,而该子窗体是StudentNav_Form
,其中包含一个导航子窗体(结尾处表示该子窗体是在其中打开该窗体的地方!)
acBrowseToForm
tells it that I'm browsing to a form (obviously!)
"ViewEditStud_Form"
is the form that I'm browsing to.
"NavigationForm.NavigationSubform>StudentNav_Form.NavigationSubform"
is the instructions of where to open it. NavigationForm
is the name of my main navigation form. .NavigationSubform>
identifies that there is a subform to open it in, and that subform is StudentNav_Form
which holds a navigation subform (and the end of that indicates that that subform is where the form is to be opened in!)
希望这对其他人有帮助!
Hope this helps anyone else!
这篇关于在导航中打开子表单(ELI5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!