All tables of CurrentDb ?

  • Thread starter Thread starter Gina
  • Start date Start date
G

Gina

Hi all.

Does someone know how to get all the table names of the current db ....

Thanks,
Gina
 
Hi,
you can either loop through Cirrentdb.TableDefs collection, or make a query
on MSysObjects table, filtering for Type=1
 
Gina said:
Hi all.

Does someone know how to get all the table names of the current db

DAO version:

'=======
Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb

For each tdf in db.TableDefs

' skip system tables
If Left(tdf.Name, 4) <> "MSys" Then
Debug.Print tdf.Name
End If

Next tdf

Set db = Nothing
'=======

In Access 2000 or later, you can also do this:

'=======
Dim ao As AccessObject

For Each ao in CurrentData.AllTables

' skip system tables
If Left(tdf.Name, 4) <> "MSys" Then
Debug.Print ao.Name
End If

Next ao
'=======

You could also do it with ADOX, but I don't have that code off the top
of my head.
 
Back
Top