在Access中设置子表单的记录源 [英] Setting the Record Source of a subform in Access

查看:104
本文介绍了在Access中设置子表单的记录源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim newRS
newRS = "SELECT DISTINCT [Grp_ID], [Group_Name], [Group_NPI] FROM [GROUP]"
Forms!loclistingfrm!LocationListSubFrm.RecordSource = newRS

当我在设计视图"中查看LocationListSubFrm子窗体时,没有记录源"属性.但是,当我直接从对象窗格访问它时,可以看到它.

When I look at the LocationListSubFrm sub form in Design View, there is no Record Source property. However, when I access it directly from the objects pane I can see it.

这是阻止我更改记录源的子表单吗?相同的子表单将在我的整个应用程序中回收,因此我无法真正在源代码中对其进行编辑.

Is the fact that it's a subform preventing me from changing the record source? The same subform is recycled throughout my application, so I can't really edit it at the source.

推荐答案

请注意,您需要处理子表单 control ,而不是(sub)表单本身:

Do note, that you need to address the subform control, not the (sub)form itself:

Dim newRS As String

newRS = "SELECT DISTINCT [Grp_ID], [Group_Name], [Group_NPI] FROM [GROUP]"
Me!NameOfYourSubformControl.Form.RecordSource = newRS

这篇关于在Access中设置子表单的记录源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆