Click to See Complete Forum and Search --> : List MS Access Tables in a VB ListBox
johnpc
Dec 7th, 1999, 08:15 AM
I have an Access Database that has a number of tables contained therein. Is there a way
to display the tables in a VB ListBox? I am
using a data control which binds the database
to the project and ListBox. Thanks
sushant
Dec 7th, 1999, 10:49 AM
I have used the following code to populate the table names in the listbix list1
Dim db As Database
Dim i As Long
Set db = OpenDatabase("C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb")
List1.Clear
For i = 0 To db.TableDefs.Count - 1
List1.AddItem db.TableDefs(i).Name
Next i
kandan
Dec 7th, 1999, 05:59 PM
hi sushant,
Its workin fine but even the system tables are also listed how to eliminate the system tables..
kandan
Serge
Dec 7th, 1999, 07:05 PM
Sure!
Dim db As Database
Dim tb As TableDef
Set db = Workspaces(0).OpenDatabase("D:\Microsoft Visual Studio\VB98\Nwind.mdb")
For i = 0 To db.TableDefs.Count - 1
If db.TableDefs(i).Attributes = 0 Or db.TableDefs(i).Attributes > 2 Then
List1.AddItem db.TableDefs(i).Name
End If
Next
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
johnpc
Dec 7th, 1999, 08:20 PM
To Sushant and Serge, both methods work
great, thank you for your help, I really
appreciate it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.