ProgrammingMSAccess.com

Learn about Developers Group
Join Developers Group
Order SPAM Blocker
Free Stuff
Guest Book
.NET Resources
SQL Server Resources
Favorites
Technical Support
Books & DVDs by Webmaster
Articles, tutorials, & more
FAQs
Product Reviews
Samples
Prior Newsletters
Contact Us
Home
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A VBA procedure that demonstrates how to list all the reports in a remote Access database.  Change STRPATH AND STRFILE SO THEY POINT TO THE DATABASE FOR WHICH YOU WANT TO LIST THE REPORTS.

Sub ListAllReportsElsewhere()
Dim obj1 As AccessObject
Dim strPath As String, strFile As String, strDBName As String

'Create a reference to another database file
Set appAccess1 = New Access.Application
strPath = "C:\PMA Samples\"
strFile = "Northwind.mdb"
strDBName = strPath & strFile
appAccess1.OpenCurrentDatabase strDBName

'Print the total number of reports in the database
Debug.Print appAccess1.CurrentProject.AllReports.Count
For Each obj1 In appAccess1.CurrentProject.AllReports
Debug.Print obj1.Name
Next obj1

'Close objects
appAccess1.CloseCurrentDatabase

End Sub

Want to understand  Microsoft Access 2000/2002/2003 so that you can program it to do more tasks like this?  Get Programming Microsoft Office Access 2003 by Rick Dobson from Microsoft Press.  Learn more about the book by clicking here.

Copyright 2003 CAB, Inc. All rights reserved. Republication or redistribution of CAB, Inc. content, including by framing or similar means, is expressly prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be liable for any errors in the content, or for any actions taken in reliance thereon.