SpaceCoastLife
asked on
Listing Ms-access tables and Record Count
How can I execute an Access 2002 query listing every table in the db and the record count in each table?
ASKER
The information is there (Debug) but How can I get it to display in a query or report?
Continuing on Anders solution
Public Function getTableCount(tableName As String) As Long
Dim tdf As DAO.TableDef
Dim tableCount As Long
For Each tdf In CurrentDb.TableDefs
If tdf.Name = tableName Then
tableCount = DCount("*", tdf.Name)
Exit For
End If
Next
getTableCount = tableCount
End Function
ASKER
John: Where do I put this code? In a form? Where are the results shown?
You put in a module and you call it anywhere as (e.g. QUery
myTable: getTableCount("MyTableName")
ASKER
Sorry for being so dense but I'm not getting it. I have your code in a module exactly as it was written and in a form as:
Call getTableCount("MyTableName "). I also tried "tempClient" instead of "MyTableName" but in either case nothing happens.
I tried it the code section of a query but that's not going to work either
Call getTableCount("MyTableName
I tried it the code section of a query but that's not going to work either
just replace the "MyTableName" with the name of one of your tables.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, guys.
Open in new window