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
Printable View
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
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
hi sushant,
Its workin fine but even the system tables are also listed how to eliminate the system tables..
kandan
Sure!
------------------Code: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
[email protected]
[email protected]
ICQ#: 51055819
To Sushant and Serge, both methods work
great, thank you for your help, I really
appreciate it.