在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 St...

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

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
阅读全文

相关推荐

最新文章