Your best option would be to create a table with the name of reports. Not
only this gave you the possibility of displaying them with a friendly name
but gave you an easy way to implement a lot of other functionalities:
displaying only a list of useful reports, restrictions, grouping (printing
multiple reports with a single launch), list of relevant controls, etc.
However, you can also enumerate the report in an ADP project by looking at
the AllReports collection. Here an example that I've used last year to make
sure that the Record Source Qualifier of all reports was set to dbo:
Public Function ADP_Rapports_RecordSourceQualifier_dbo()
Dim bASauvegarder As Boolean
bASauvegarder = False
Dim i As Integer
i = 0
Dim objDAP As AccessObject
Dim f As Report
Dim c As Control
Dim ct As Long ' Pour ControlType.
Dim s As String
'''' For Each objDAP In CurrentProject.AllForms
For Each objDAP In CurrentProject.AllReports
'''' Debug.Print "The '" & objDAP.name & "' is located at: " &
objDAP.FullName
If (True) Then
i = i + 1
DoCmd.OpenReport objDAP.name, acDesign
Set f = Reports(objDAP.name)
Debug.Print Now() & ": " & objDAP.name
If ((f.RecordSource & "") <> "") Then
If (f.RecordSourceQualifier <> "dbo") Then
bASauvegarder = True
f.RecordSourceQualifier = "dbo"
' Debug.Print Now() & ": " & objDAP.name & ": Modifiée"
End If
End If
For Each c In f.Controls
' Debug.Print ctrl.Name
' If (TypeOf ctrl Is TextBox) Then
ct = c.ControlType
' 1) Liste des objets pouvant avoir un ControlSource.
' Note: les acOptionButton peuvent également avoir un
RecordSource
' si leurs parents n'est pas un acOptionGroup.
If (False And ct = acCheckBox Or _
ct = acComboBox Or _
ct = acListBox Or _
ct = acOptionGroup Or _
ct = acTextBox Or _
ct = acToggleButton Or _
ct = acBoundObjectFrame) Then
If (False) Then
bASauvegarder = True
End If
End If
' 1) Liste des objets pouvant avoir un RowSource.
If (ct = acComboBox Or ct = acListBox) Then
' Debug.Print Now() & ": " & c.RowSource
' Debug.Print Now() & ": " & c.RowSourceType
If (c.RowSourceType & "" = "Table/View/StoredProc") Then
s = c.RowSource & ""
If (Left(s, 4) <> "dbo.") Then
c.RowSource = "dbo." & s
bASauvegarder = True
End If
End If
End If
Next
If (bASauvegarder = True) Then
bASauvegarder = False
DoCmd.Close acReport, objDAP.name, acSaveYes
Else
DoCmd.Close acReport, objDAP.name, acSaveNo
End If
End If
Next objDAP
End Function