VBA Code To List Objects in Access Database
VBA Code To List Objects in Access Database
1 of 5
http://www.consultdmw.com/access-VBA-list-objects.htm
HOME
DATABASES
SPREADSHEETS
TEMPLATES
CONSULTANCY
ABOUT DMW
Listing database objects made easy
access Q&A
excel Q&A
technical notes
convert DB
site map
5/10/2016 4:32 PM
2 of 5
http://www.consultdmw.com/access-VBA-list-objects.htm
7.
8. Set dB = Application.CurrentData
9. For Each tbl In db.AllTables
10. Debug.Print tbl.Name
11. Next tbl
12.
13. strMsg = " -- Tables listing complete -- "
14.
15. Procedure_Done:
16. dmwListAllTables = strMsg
17. Exit Function
18.
19. Error_Handler:
20. strMsg = Err.Number & " " & Err.Description
21. Resume Procedure_Done
22.
23. End Function
Comments
Note that the list of tables that dmwListAllTables() generates includes the names of system tables that are
usually hidden from the database user's view. Such tables have names beginning with 'MSys'.
5/10/2016 4:32 PM
3 of 5
http://www.consultdmw.com/access-VBA-list-objects.htm
5/10/2016 4:32 PM
4 of 5
http://www.consultdmw.com/access-VBA-list-objects.htm
5/10/2016 4:32 PM
5 of 5
http://www.consultdmw.com/access-VBA-list-objects.htm
Disclaimer
DMW Consultancy Limited does not accept any liability for loss or damage to data to which any techniques,
methods or code included in this website are applied. Back up your data; test thoroughly before using on live
data.
Copyright 20102016 DMW Consultancy Ltd Tonbridge Kent
top
5/10/2016 4:32 PM