访问Access 2010中其他表单控件的值 [英] Accessing the value of a control on other form in access 2010
问题描述
我有一个位于子窗体在访问一个标签形式的列表框对象。我想,当我在新窗口中使用下面的打开另一种形式来访问所选择的值是:
I have a Listbox object that is located in a subform in a tabbed form in access. I wish to access the selected value in it when I open another form in a new window using the below:
DoCmd.OpenForm "New form", , , , , acDialog
与标签式界面,假设我的主要形式被称为主页,子窗体被称为按项目搜索和列表框对象被称为filteredList,我希望得到的新形式,从filteredList价值在装载形式。我通过网上提供的各种语法困惑,他们似乎并没有为我工作。我想知道什么是正确的语法?非常感谢!
Assuming my main form with the tabbed interface is called "Main Page" ,the subform is called "Search by project" and the listbox object is called "filteredList", I wish to get the value from filteredList in "New form" during loading of the form. I am confused by the various syntax provided online as they do not seem to be working for me. May I know what is the correct syntax? Thanks a lot!
推荐答案
有若干这样做的方式。让我们说你的code,打开第二种形式是主页上,你有一个简单的,没有多选列表框,您可以使用OpenArg:
There are a number of ways of doing this. Let us say that your code to open the second form is on Main Page and you have a simple, not multi-select listbox, you can use an OpenArg:
DoCmd.OpenForm "New form", , , , , acDialog, _
Me.[NameOfSubformControlNotFormContained].Form.filteredList
如果在code是在子窗体,你说:
If the code is in the subform, you say:
DoCmd.OpenForm "New form", , , , , acDialog, Me.filteredList
要引用子窗体的另一种形式:
To refer to a subform from another form:
Forms![Main Form]![NameOfSubformControlNotFormContained].Form!filteredList
或
Forms![Main Form].[NameOfSubformControlNotFormContained].Form.filteredList
另请参阅: http://access.mvps.org/access/forms/frm0031热媒
这篇关于访问Access 2010中其他表单控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!