Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping over all the tables in a database

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
This has to be easy, but I have a little VB program which operates on all the tables in a database, as it stands, I have to run it once for each table and tell it the table name... now I know there has to be a way for it to loop over all the tables in the database right?

Anyone want to tell me the incredibly easy way that I can't seem to locate?

I'm using both ADOX and ADOB in the program, so I'd like to stick to one of those rather than adding any DAO if possible.

Thanks,

Rob
 
How about this:
Code:
Dim cat as new ADOX.Catalog
Dim tbl as ADOX.Table

cat.ActiveConnection=currentProject.Connection

For Each tbl in cat.Tables
  if tbl.Type="View" then Debug.Print "Table Name: " & tbl.Name
Next tbl

Hope this helps,
Rewdee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top