?
Solved

List TableNames from MS Access DB

Posted on 2003-03-18
5
Medium Priority
?
153 Views
Last Modified: 2010-05-01
Once I'm connected, what's the SQL statement (or....???) to list into a recordset/array the names of all the tables in the database?  I need the list from a MS Access file (*.mdb) -I'm doing this in VB6
Thx in advance.
0
Comment
Question by:LosBear
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 200 total points
ID: 8162658
0
 
LVL 11

Expert Comment

by:supunr
ID: 8162942
SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Name) Not Like "MSys*") AND ((MSysObjects.Type)=1));

Good Luck!
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8162970
You should also take a look at OpenSchema : http://support.microsoft.com/default.aspx?scid=kb;en-us;186246
0
 

Expert Comment

by:mooresrock
ID: 8167623
Dim db as Database, td as TabDef
SET db = DBEngine.OpenDatabase("full db path name")

FOR Each td IN db.TableDefs
    'td.Name is here.  Add to ListBox or whatever

NEXT
END SUB

0
 
LVL 1

Author Comment

by:LosBear
ID: 8168342
thanks for your help guys  -
I followed aelatik's link and saw the crap everyone posted: here's the simplified version for the next guy who comes around:


    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\file.mdb"

        Set RS = objConn.OpenSchema(adSchemaTables)

        Do Until RS.EOF
              strTableName = RS("TABLE_NAME")
                   Combo1.AddItem strTableName
            RS.MoveNext
        Loop


I'm awarding the points to aelatik 'cause he was first; but thanks for all your help
Catcha l8r
Bear
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question