简体   繁体   English

MS Access:如何以编程方式添加子窗体

[英]MS Access: How to Programmatically Add a Subform

Is there a way to programmatically add a subform to a form using Access VBA? 有没有办法以编程方式使用Access VBA将子表单添加到表单? I have a temporary table that is generated dynamically when requested by the user. 我有一个临时表,在用户请求时动态生成。 If possible, I would like to create a form based on the temporary table and add it as a subform to a pre-existing form. 如果可能的话,我想基于临时表创建一个表单,并将其作为子表单添加到预先存在的表单中。

The best bet is to create the subform control and set the source object to either a table or a query. 最好的办法是创建子窗体控件并将源对象设置为表或查询。

Me.NameOfSubformControl.SourceObject = "Query.Query1"
Me.NameOfSubformControl.SourceObject = "Table.Temp"

It is also possible to update the sql of a saved query to reference the new temp table. 还可以更新已保存查询的sql以引用新临时表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM