Getting list of tables in Access file with VB 
Author Message
 Getting list of tables in Access file with VB

   Does anyone have some DAO code to generate a list of tables in an Access
database? I am trying to write a VB program that can open an Access database
and allow the user to read data from it. All the code examples I have been able
to find assume you know the table names and then allow you to open a table to
read the records. It would be nice (necessary, really) to be able to present
the user with a list of tables in the database to choice from. They can then
access individual records. Ideally, the code should work in both VB 4 and VB 6.


Fri, 03 May 2002 03:00:00 GMT  
 Getting list of tables in Access file with VB
This loop should get thte name of all tables except the system tables:

Dim db As Database
Dim tbl As TableDef
Set wsp = DBEngine.Workspaces(0)
Set db = wsp.OpenDatabase(dbName)

 For i = 0 To db.TableDefs.Count - 1
        If Mid(db.TableDefs(i).Name, 2, 3) <> "sys" Then
               msgbox db.TableDefs(I).Name
        end
 next i

Tim H.



Fri, 03 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting list of Access DB tables with VB

2. Getting a list of tables from a Access DB

3. getting a table list from Access'97 database

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

5. Getting list of reports and printing from Access DB using VB

6. How to make an Access table with a list of files meeting some criteria

7. help getting access VB 3.0 system tables

8. Getting Access data table names in VB 5 (SP3)

9. Getting Access data table names in VB 5 (SP3)

10. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

11. Listing Access tables in VB DAO

12. Accessing .DBF-files (or MS-Access tables) from VB

 

 
Powered by phpBB® Forum Software