ADOX tables and Fields names

csharp , db Argentina
  • 13 years ago


    Does anyone have a "How To" article or a suggested link in order to retrive Tables and Fields names from a ACCDB and MDB File?


  • 13 years ago

    retrieve to ?

    .. sql, oracle, c++, vb6, perl, excel, word, ...

    MS has plenty of articles on how to manipulate tables and fields in msaccess, but you'd need to use one of their component libraries.

    For instance, in Excel, reference to "Microsoft DAO 3.6 Object Library"

    Public Sub GetTablesAndFields()
        On Error GoTo err_GetTablesAndFields

        Dim db As DAO.Database
        Dim tbl As DAO.TableDef
        Dim fld As DAO.Field
        Set db = DBEngine.OpenDatabase("...\xxx.mdb")
        For Each tbl In db.TableDefs
            Debug.Print tbl.Name
            For Each fld In tbl.Fields
                Debug.Print "... " & fld.Name
            Next fld
        Next tbl    
        If (Not db Is Nothing) Then
        End If
        Exit Sub
        Debug.Print Err.Description
        GoTo sub_exit

    End Sub



Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray