You need to open the report to get its RecordSource.
This example shows how to loop through all your forms or reports, printing
the Name and RecordSource of each one. Pass True for reports:
Public Function ShowRecordSource(bReports As Boolean)
Dim accobj As AccessObject
Dim strDoc As String
If bReports Then
For Each accobj In CurrentProject.AllReports
strDoc = accobj.Name
If accobj.IsLoaded Then
Debug.Print strDoc, Reports(strDoc).RecordSource
Else
DoCmd.OpenReport strDoc, acDesign, WindowMode:=acHidden
Debug.Print strDoc, Reports(strDoc).RecordSource
DoCmd.Close acReport, strDoc
End If
Next
Else
For Each accobj In CurrentProject.AllForms
strDoc = accobj.Name
If accobj.IsLoaded Then
Debug.Print strDoc, Forms(strDoc).RecordSource
Else
DoCmd.OpenForm strDoc, acDesign, WindowMode:=acHidden
Debug.Print strDoc, Forms(strDoc).RecordSource
DoCmd.Close acForm, strDoc
End If
Next
End If
End Function