我有一个活动公司数据库的场地形式。在这个表格中,有一个场地类型的子表格,可以包括酒店、酒吧、餐厅等
我想使用 VBA 代码让表单根据此子表单中的内容显示某些字段和标签页
例如,如果它是一个文本框,我可以说: If [VenueTypes subform].VenType = "Hotel" then PageHotel.Visible = true
搜索子表单的等效项是什么?
非常感谢!
我有一个活动公司数据库的场地形式。在这个表格中,有一个场地类型的子表格,可以包括酒店、酒吧、餐厅等
我想使用 VBA 代码让表单根据此子表单中的内容显示某些字段和标签页
例如,如果它是一个文本框,我可以说: If [VenueTypes subform].VenType = "Hotel" then PageHotel.Visible = true
搜索子表单的等效项是什么?
非常感谢!
I think you don't want to search the subform, but to access one control on it. Search for data should always be done by a query, because a form doesn't store data, it just presents it.
From the "code behind form" you can access a control on a subform by
Me.subFormControl.Form.controlOnSubform.Value
"subFormControl" is the name of the subform object (not the form being used to populate the subform).
"controlOnSubform" is the name of the control on the subform.
Whenever the subform's data is changing, this can be recognized by the subform's "OnCurrent" event. The code for this event should tell the main form to update its content:
Me.Parent.nameOfThePublicSubInParentForm