troubleshooting Question

Enumerate Access Reports in VB6

Avatar of jkaios
jkaiosFlag for Marshall Islands asked on
Microsoft AccessVisual Basic Classic
4 Comments2 Solutions733 ViewsLast Modified:
Is it possible to enumerate reports in an Access database using ADO in VB6?

I tried the following code, but no success.  Did I miss something?


Option Explicit

Dim oAcc As New Access.Application
   
Private Sub Command1_Click()
   
   Dim ii As Long
   
   oAcc.OpenCurrentDatabase "C:\Temp\DB1.mdb"
   '*** oAcc.DoCmd.OpenReport "Report1", acViewPreview, , , acDialog
   oAcc.Visible = True
   
   Debug.Print oAcc.Reports.Count     '<-- THIS RETURNS ZERO (0)

   For ii = 0 To oAcc.Reports.Count - 1
      Debug.Print oAcc.Reports(ii).Name
   Next
     
End Sub

Private Sub Form_Unload(Cancel As Integer)
   oAcc.CloseCurrentDatabase
   oAcc.Quit
   Set oAcc = Nothing
End Sub
ASKER CERTIFIED SOLUTION
mysteriousguy

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros