Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2005

Tip: Looking for answers? Try searching our database.

All tables of CurrentDb ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gina - 27 Jul 2005 14:17 GMT
Hi all.

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

Thanks,
Gina
Alex Dybenko - 27 Jul 2005 14:31 GMT
Hi,
you can either loop through Cirrentdb.TableDefs collection, or make a query
on MSysObjects table, filtering for Type=1

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi all.
>
> Does someone know how to get all the table names of the current db ....
>
> Thanks,
> Gina
Dirk Goldgar - 27 Jul 2005 14:38 GMT
> 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.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Gina - 27 Jul 2005 14:43 GMT
... thanks guys for you fast answers !!!!

great ....

Gina :)

> > Hi all.
> >
[quoted text clipped - 37 lines]
> You could also do it with ADOX, but I don't have that code off the top
> of my head.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.