Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'---------------------------------------------------------------------------------------
' Procedure : ListAllTables_Size
' Author : Gustav(original)
' Created : 11/15/2009
' Purpose : To get approximate sizes of all
'non-MSys tables in an Access mdb.
'Outputs table names and sizes to immediate window.
'
'From AccessD discussion-
'---------------------------------------------------------------------------------------
' Last Modified:
'
' Inputs: N/A
' Dependency: Microsoft DAO 3.6 Object Library
'------------------------------------------------------------------------------
'
Public Sub ListAllTables_Size()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim strName As String
Dim strFile As String
Dim strPath As String
Dim lngBase As Long
Dim lngSize As Long
On Error GoTo ListAllTables_Size_Error
Set dbs = CurrentDb
strName = dbs.Name
strPath = Left(strName, Len(strName) - Len(Dir(strName)))
' Create empty database to measure the base file size.
strFile = strPath & "base" & ".mdt"
CreateDatabase strFile, dbLangGeneral
lngBase = FileLen(strFile)
Kill strFile
Debug.Print "Base size", lngBase
For Each tdf In dbs.TableDefs
strName = tdf.Name
' Apply some filtering - ignore System tables.
If Left(strName, 4) <> "MSys" Then
strFile = strPath & strName & ".mdt"
Debug.Print strName, ;
CreateDatabase strFile, dbLangGeneral
DoCmd.TransferDatabase acExport, "Microsoft Access", strFile, acTable, strName, strName
lngSize = FileLen(strFile) - lngBase
Kill strFile
Debug.Print lngSize
End If
Next
Set tdf = Nothing
Set dbs = Nothing
On Error GoTo 0
Exit Sub
ListAllTables_Size_Error:
MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure ListAllTables_Size "
End Sub