Counting tables BUT not system tables 
Author Message
 Counting tables BUT not system tables

Hello,

Can anyone tell me how to count the number of tables in a
DB, but that number should NOT include the system/hidden
tables??

Thanks for any help.

Dave



Sun, 01 Feb 2004 23:39:04 GMT  
 Counting tables BUT not system tables
Dave,

Public Function fCountTables() As Integer
Dim db As Database
Dim tdf As TableDef
Dim i As Integer

Set db = CurrentDb

i = 0
For Each tdf In db.TableDefs
    If tdf.Attributes And dbSystemObject Or _
       tdf.Attributes And dbHiddenObject Then
        'Ignore
    Else
        i = i + 1
    End If
Next

Set db = Nothing
fCountTables = i
End Function

Hope this helps,

James

Quote:

> Hello,

> Can anyone tell me how to count the number of tables in a
> DB, but that number should NOT include the system/hidden
> tables??

> Thanks for any help.

> Dave



Mon, 02 Feb 2004 00:04:19 GMT  
 Counting tables BUT not system tables
A Query with the following SQL String:

SELECT Count(*) AS TableCount
FROM MSysObjects
WHERE (((MSysObjects.Type)=1 Or (MSysObjects.Type)=6) AND
((MSysObjects.Name) Not Like "MSys*"));

should give you the Count of non-system Tables (local or linked).

HTH
Van T. Dinh


Quote:
> Hello,

> Can anyone tell me how to count the number of tables in a
> DB, but that number should NOT include the system/hidden
> tables??

> Thanks for any help.

> Dave



Mon, 02 Feb 2004 08:05:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Eliminate records of one table based on another table record count

2. Enumerate table and query names in ADO excluding system tables

3. Attached table and not attached table

4. Counting Tables/Delete by Create Date

5. Counting Tables through code

6. How to count the records added to a table

7. Adding a sequential date count number to an imported table

8. Record Count on a closed table

9. Dynamic Counter in a Table or a Query to Count Records (Q199679)

10. How to Simulate a Dynamic Counter in a Table or a Query to Count Records

11. Count across fields in a table

12. Count number of occurances in table

 

 
Powered by phpBB® Forum Software