Find Report Record source

J

jjflash

Knowing the report name, how do I programatically get the "recordsource"
(query name) from a report.
 
A

Allen Browne

Most of the properties are available only when the report is open, so:

Dim strDoc As String
strDoc = "Report1"
DoCmd.OpenReport strDoc, acViewDesign, WindowMode:=acHidden
Debug.Print Reports(strDoc).RecordSource
DoCmd.Close acReport, strDoc

Note: The WindowMode argument will not work with earlier versions of Access.
 
Top