Can someone tell me what's wrong with this code? I'm just trying to loop through the reports in an Access .mdb and extract the names, so that I can give my users a nice list of reports to print. I'm using Access 97 and VB 6 to do this. Everything looks good to me, but it never enters the loop. When I check the Reports.Count property, it tells me 0, but I have 2 reports in there. What's going on?
Code:
Dim AccessApp As Access.Application
Dim rep As Access.report
Set AccessApp = New Access.Application
AccessApp.Visible = False
AccessApp.OpenCurrentDatabase "mydb.mdb"
For Each rep In AccessApp.Reports
Report_list.AddItem rep.name
Next
AccessApp.CloseCurrentDatabase
Set AccessApp = Nothing