View Single Post
  #2 (permalink)  
Old February 27th, 2008, 10:10 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Here is code I used to populate a list box, called List2, with all the tables names in the database on the form On Load event:

Private Sub Form_Load()
Dim obj As AccessObject
Dim dbs As Object
Dim ctrlListBox As ListBox

Set dbs = Application.CurrentData
Set ctrlListBox = Me.List2

    With ctrlListBox
     For Each obj In dbs.AllTables

        .AddItem Item:=obj.Name

     Next obj
    End With

End Sub

This shows system tables so you are going to have to remove those from the list if you don't want them selected. Do you need more help?


mmcdonal

Look it up at: http://wrox.books24x7.com
Reply With Quote