How can I find out the size of each table in my database
How can I find out the size of each table in my database
Microsoft AccessVBA
Last Comment
ANTHONY CHRISTI
8/22/2022 - Mon
Scott McDaniel (EE MVE )
The only way to accurately determine the size is to export each table to a separate database, and compare before and after sizes.
You can estimate the size by determining the maximum size of each Field in each table, and then summing those to find the size of a "row", and then multiplying that by the number of rows in the table. This would give you a very rough estimate of the table size - but if you have Memo, Attachment or any other multivalued fields then you really can't use this method.
Scott McDaniel (EE MVE )
Also, there are some 3rd party utilities that do this, like Total Access Analyzer:
Not sure how/where you need this data displayed, ...
But try code like this as a start:
Dim tdf As TableDef
Dim strRecCount As String
For Each tdf In CurrentDb.TableDefs
If Left(tdf.Name, 4) <> "msys" Then
strRecCount = strRecCount & vbCrLf & "The table " & tdf.Name & " has " & DCount("*", tdf.Name) & " records"
End If
Next tdf
Note that code like this will take a while to run if you have a lot of tables with a lot of records
You can estimate the size by determining the maximum size of each Field in each table, and then summing those to find the size of a "row", and then multiplying that by the number of rows in the table. This would give you a very rough estimate of the table size - but if you have Memo, Attachment or any other multivalued fields then you really can't use this method.