Connecting Tech Pros Worldwide Forums | Help | Site Map

How can I create a list of another database's objects?

G Gerard
Guest
 
Posts: n/a
#1: Mar 26 '07
Hello



I am trying to connect to a msaccess database and then create a list of the
objects in that database (more specifically the tables) and then create a
list of the fields (including the field type) for each table.



How can I do this?



Thanks

G Gerard



storrboy
Guest
 
Posts: n/a
#2: Mar 26 '07

re: How can I create a list of another database's objects?


On Mar 25, 7:50 pm, "G Gerard" <gger...@nbnet.nb.cawrote:
Quote:
Hello
>
I am trying to connect to a msaccess database and then create a list of the
objects in that database (more specifically the tables) and then create a
list of the fields (including the field type) for each table.
>
How can I do this?
>
Thanks
>
G Gerard

You should be able to get at the different collections through the
database object (assuming DAO) like you would using CurrentDB.

Set db = (method of opening/creating database)
db.TableDefs()
db.QueryDefs()
db.Documents("Forms").Document()

and so on.

May I ask why?

Allen Browne
Guest
 
Posts: n/a
#3: Mar 26 '07

re: How can I create a list of another database's objects?


OpenDatabase() on the file name.
Table names are in MSysObjects.
Loop through the TableDefs to show the field names and types.

An example of how to list the fields, types, and descriptions for tables:
http://allenbrowne.com/func-06.html

This is a more comprehensive example:
http://allenbrowne.com/AppIssueChecker.html
Illustrates how to:
- choose a database, and OpenDatabase;
- loop through the TableDefs, and examine each field, including the names
and properties of the database, tables, and fields;
- do a bunch of other stuff as well.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"G Gerard" <ggerard@nbnet.nb.cawrote in message
news:KNENh.15290$PV3.157535@ursa-nb00s0.nbnet.nb.ca...
Quote:
>
I am trying to connect to a msaccess database and then create a list of
the objects in that database (more specifically the tables) and then
create a list of the fields (including the field type) for each table.
Closed Thread