DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Using to get table names

  1. #1
    Join Date
    Jul 2009

    Question Using to get table names

    I would like to be able to provide users a list of available tables (table names) when they connect to a new database (Access 2003). The tables will have have been made externally by the user and they point to the name of the file (e.g. MyAccess.mdb) to access the data.
    Does anyone know how to access this information? I found articles on "TableDirect" but have not been able to see examples of implementation and the help files seem to indicate this is used for reading from the tables.
    Much appreciate any help

  2. #2
    Join Date
    May 2004
    Duluth MN
    The following information is for Access 2000. Access 2003 may be different, but you should be able to discover any differences. I usually use ole automation to get this information, but you should be able to query the MSysObjects table for the name of those items with Type = 1 (4 for linked tables). In Access 2000 I went to Tools/Options. On the view tab I checked System Objects to make the table visible. You can check the fields/values there for your query.


  3. #3
    Join Date
    Feb 2004
    Longueuil, Québec
    First add a reference to the Microsoft Access Object Library in your project's COM references.

    The following job displays the name of the tables in the Output Window, use the same to fill your list:

    Dim app As New Microsoft.Office.Interop.Access.Application
    app.Visible = False    'Otherwise Access appears to the user
    For Each table As dao.TableDef In app.CurrentDb.TableDefs
    app.Quit()    'Otherwise Access keeps running invisible in the background
    In order for the Microsoft.Office.Interop namespace to be available, the Microsoft Office PIA (Primary Interop Assembly) must be installed on the development computer as well as on all the user stations. The PIA is installed when you specify that you want the .NET components when installing Office. It can also be installed independantly through a download on the Microsoft web site.
    Jacques Bourgeois

Similar Threads

  1. Columns names of specific table in MS Access
    By SpookyDescendan in forum C++
    Replies: 0
    Last Post: 10-25-2006, 10:41 AM
  2. Attn: Daniel Reber
    By joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 06:25 PM
  3. Re: (No subject)
    By Joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 06:13 PM
  4. Select Columns names from a table.
    By Faisal in forum VB Classic
    Replies: 4
    Last Post: 02-19-2002, 09:31 PM
  5. Listing Table Names in Combo Box
    By Jeremy Shipley in forum VB Classic
    Replies: 2
    Last Post: 05-14-2000, 10:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center