Accessing Report 'Record Source' field 
Author Message
 Accessing Report 'Record Source' field

How do I loop through all the reports in an application an access their
'record source'?


Fri, 05 Jan 2001 03:00:00 GMT  
 Accessing Report 'Record Source' field
Hi Keith,

Use the Reports Container.

'*********** Code start ***********
Sub sEnumRpts()
Dim db As Database, ctr As Container
Dim doc As Document, rpt As Report
    Set db = CurrentDb
    Set ctr = db.Containers!Reports
    For Each doc In ctr.Documents
        With doc
            DoCmd.OpenReport .Name, acViewDesign
            Set rpt = Reports(.Name)
            Debug.Print rpt.RecordSource
            DoCmd.Close acReport, .Name, acSaveNo
        End With
    Next
    Set rpt = Nothing
    Set doc = Nothing
    Set ctr = Nothing
    Set db = Nothing
End Sub
'********** Code End *************

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

:How do I loop through all the reports in an application an access their
:'record source'?
:
:



Fri, 05 Jan 2001 03:00:00 GMT  
 Accessing Report 'Record Source' field
You can't, unless you open each report in design view first.  This is 'ugly'
but it works.

Sub ListReportsRecordsource()
Dim doc As Document
Dim db As Database
Dim strName As String

    Set db = CurrentDb()

    For Each doc In db.Containers("reports").Documents
        strName = doc.Properties!Name
        DoCmd.OpenReport strName, acViewDesign
        Debug.Print "Report: " & strName & " Recordsource: " &
Reports(strName).RecordSource
        DoCmd.Close acReport, strName, acSaveNo
    Next doc

End Sub

Quote:

>How do I loop through all the reports in an application an access their
>'record source'?



Fri, 05 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Adding field to the current source does'nt add source to FROM clause

2. Use Word checkbox control's double click action to update field in access database record

3. Update 'NULL' to record field

4. 'Record Number' (total) field

5. sub report changes its source stored procedure to main report's stored procedure

6. Problem w/Access '97 and Crystal Reports Formatting Time Fields

7. Problems adding new records to ODBC source (dBASE III dbf's)

8. Record Set Guru's - Can't Create Record Set error 429

9. Record Set Guru's - Can't Create Record Set error 429

10. OpenRecordset and a report's Control Source

11. Data Report can't execute normally after source code compiled

12. changing a data report image control's source in code

 

 
Powered by phpBB® Forum Software