Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

List TableNames from MS Access DB

Posted on 2003-03-18
5
Medium Priority
?
154 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
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

580 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