|
-
Dec 7th, 1999, 09:15 AM
#1
Thread Starter
Addicted Member
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
-
Dec 7th, 1999, 11:49 AM
#2
Junior Member
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
-
Dec 7th, 1999, 06:59 PM
#3
Member
hi sushant,
Its workin fine but even the system tables are also listed how to eliminate the system tables..
kandan
-
Dec 7th, 1999, 08:05 PM
#4
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
-
Dec 7th, 1999, 09:20 PM
#5
Thread Starter
Addicted Member
To Sushant and Serge, both methods work
great, thank you for your help, I really
appreciate it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|