在VBA中你如何返回一个基础查询的名称报表对象? [英] In VBA how do you return the name of an underlying query for a report object?

查看:163
本文介绍了在VBA中你如何返回一个基础查询的名称报表对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得后面的具体报告查询的名称。我希望做这样的事情...

I would like to obtain the name of a query behind a specific report. I was hoping to do something like this...

 Dim QueryName As String
 QueryName = CurrentProject.AllReports(MyReportName).RecordSource.Name

不过,我知道这是不行的,但我想找到这样做的手段。有什么,我明明可以俯瞰?

However, I know this does not work, but I would like to find a means of doing this. Is there something I am obviously overlooking?

推荐答案

您必须打开报表才能访问这些类型的属性。

You have to open the report to get access to those kinds of properties.

开放式的设计模式,这样你不实际运行的东西。

Open in design mode so you don't actually run the thing.

Dim QueryName As String

DoCmd.OpenReport MyReportName, acViewDesign

QueryName = Reports(MyReportName).RecordSource

DoCmd.Close acReport, MyReportName

这篇关于在VBA中你如何返回一个基础查询的名称报表对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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