Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of tables

Status
Not open for further replies.

jonnyk

Programmer
Jan 11, 2001
19
0
0
GB
I need to popukate a list box with the tables in the database.
I believe listtables mayt do the trick but can find no reference to it in the help (access 2000)
 
Hi jonnyk,

I don't know of any listtables function.

To populate a listbox with a UDF requires a special format. I can find an example if you want, but in your case you can probably do it more easily simply by running through the Tabledefs collection and building the list as a string.

In your form's OnCurrent event put something like this:

Code:
Dim db As DAO.database
Dim tbl As DAO.TableDef

Set db = CurrentDb

Me!ListBox1.RowSourceType = "Value List"
For Each tbl In db.TableDefs
    Me!ListBox1.RowSource = Me!ListBox1.RowSource & """" & tbl.Name & """;"
Next

You may find it more efficient to build the list once and save it rather than building it every time - it depends on exactly what you are doing.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top