Getting a list of Tables and fields in an access database 
Author Message
 Getting a list of Tables and fields in an access database

does anyone know how to open a database and get access to tell you what
tables are in the database and obviously how many, and then what fields
are in each table and the type of field.

I'm looking to build an extra function to my project which needs this

Any replys to my email address would be great

Thanks to you all in advance

Sun, 30 Jul 2000 03:00:00 GMT
 Getting a list of Tables and fields in an access database

Here you go.  The type property is a number value that correlates to some
intrinsic constants.  Just check out the help for Type.

Private Sub Command1_Click()

    Dim DataBase As DataBase
    Dim TableDef As TableDef
    Dim Field As Field

    Set DataBase = DBEngine.Workspaces(0).OpenDatabase("C:\Program
Files\Microsoft Office 97\Office\Samples\Northwind.mdb", False, True)

    Debug.Print "Table count: " & DataBase.TableDefs.Count
    For Each TableDef In DataBase.TableDefs
        Debug.Print vbTab & "Table: " & TableDef.Name
        For Each Field In TableDef.Fields
            Debug.Print vbTab & vbTab & "Field: " & Field.Name & vbTab &
"Type: " & Field.Type
        Next Field
    Next TableDef

    Set DataBase = Nothing

End Sub


Sun, 30 Jul 2000 03:00:00 GMT
 [ 2 post ] 

 Relevant Pages 

1. getting data from access database table to VB4 list box

2. Getting a list of fields in a table...

3. Problem getting list of fields in table

4. Getting a list of tables from a Access DB

5. Getting list of Access DB tables with VB

6. Getting a list of available tables in an Access file

7. Getting a list of tables in a database with Perl

8. Getting a list of Tables in a Database

9. getting list of databases and tables using sybperl?

10. getting field count on an Access table

11. Getting all tables and fields from the database

12. How to modified existing field and add new field in existing table for Access database

Powered by phpBB® Forum Software