Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Retrieving Table List

Question:
How can I get the tables within an Access2.0 database to show in a list box? The user will specify a database in a text box and I want them to be able to choose which table they want to work with. Also, once I get the table, how can I have the fields of that table show up in another list box? I have tried using the List Fields Method to no avail.

Answer:
You can loop through the TableDefs collection, which is a property of the Database object. Those are all the tables in the currently active database. You can add them into the list box with the AddItem method. Here's an example:

Dim db as Database
Dim td as TableDef
Set db = OpenDatabase("Filename")
ListBox.Clear
For Each td In db.TableDefs
   ListBox.AddItem td.Name
   db.TableDefs.MoveNext
Loop
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date