-
Heres my code to generate the list of reports.
I get nothing out and temp = 0 but I have three reports!!
can anyone help?
:confused: H.
Code:
Private Sub Form_Load()
' Initialise list of reports
Dim temp As Integer
Dim temploop As Integer
Set ErrReport = CreateObject("Access.Application")
ErrReport.OpenCurrentDatabase "C:\db1.mdb"
temp = ErrReport.Reports.Count
For temploop = 0 To temp - 1
lstReports.List(temploop) = ErrReport.Report(temploop).Name
Next
End Sub
-
Code:
Dim x As New Access.Application
Dim obj As AccessObject, dbs As Object
x.OpenCurrentDatabase "c:\db1.mdb"
Debug.Print x.CurrentProject.AllReports.Count
hth :)
-
Sorry but currentproject isn't recognised.
What I'm trying to do is display a list of all available reports so that users can click on them and open them.
If I manually fill the list the program works but what I want to do is get the names of all available records and fill the list using a loop rather than hard code
do you have any ideas?
-
-
Hollie,
read my post in the Database thread. Key is to use the Documents in the Containers collection. Reports collection is the OPEN reports only.
Cheers,
P.
-
Thanks for all your help guys!
:D Hollie :D
-
Hollie,
This works fine on my machine, Except it lists the reports in reverse order (shouldn't be too difficult to solve)
Using ACCESS 2000, via the 9.0 Object Lib
Code:
Private Sub Command1_Click()
' Initialise list of reports
Dim temp As Integer
Dim temploop As Integer
Dim Y As Object
Set ErrReport = CreateObject("Access.Application")
ErrReport.OpenCurrentDatabase "C:\db1.mdb"
For Each Y In ErrReport.CurrentProject.AllReports
List1.AddItem Y.Name
Next Y
End Sub
-
Quote:
Originally posted by crispin
Hollie,
...Except it lists the reports in reverse order (shouldn't be too difficult to solve)...
Code:
...
List1.AddItem Y.Name
...
Try this:
Code:
...
List1.AddItem Y.Name , 0
...
-
Thanks for all your help guys - I have now got it working!
:D H. :D