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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I determine table names in an mdb? 2

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
I'm an experienced MS Access VBA programmer that needs to know how to determine the table names of an mdb using vba code. I also need to then determine a table's field structure with VBA code.

Thank you!

Steve G.
 
Have a look at the TableDefs and Fields DAO collections.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm an ADO programmer. I don't work with DAO anymore. Is an ADO approach instead? When looking up "TableDef" alone I only get DAO references to it.

Steve
 
You may try to play with an ADOX Catalog object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Or take a look at the OpenSchema method of the connection.

Roy-Vidar
 
Table names:

Select [Name] From MSysObjects Where Type=1 ?


Then...loop through the recordset to get the fields of each table

"Select * From " & rst("Name")

Then...For Each fld in rst2.Fields...check the name, type, length and so on?

ADO or DAO, what difference does it make?

Not bad with TableDefs though, for Jet.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top