[AccessD] List all tables and their fields

Stuart McLachlan stuart at lexacorp.com.pg
Fri Mar 17 03:37:07 CDT 2023


Same issue as asked and ansered  24 August and 11 October last year?

To get all the tables and their fields in the current database.

A couple of warnings:
You should write them out to a file - the Immediate window probably won't have a large 
enough buffer to see everything
You make like to exclude all the MSys tables.


Function ListTablesAndFields() As Long
Dim tdf As TableDefs
Dim td As TableDef
Dim fd As Field
Set tdf = CurrentDb.TableDefs
For Each td In tdf
    Debug.Print td.Name
    For Each fd In td.fields
        Debug.Print "-----" & fd.Name & " : " & fd.Type
    Next
Next
End Function




On 17 Mar 2023 at 2:48, Arthur Fuller wrote:

> I had some code that would list all tables and the fields for each of
> them. Now that I need it, I can't find it. I tried Microsoft Learn but
> couldn't find it there either.
> 
> Suggestions?
> 
> -- 
> Arthur
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list