View Single Post
  #1 (permalink)  
Old March 28th, 2013, 12:39 PM
Flipper Flipper is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default tables and fields listboxes

I am using a form with two list boxes to provide the user with query building tools. The form should list the tables(lstbx1) and the fields(lstbx2) and allow user to make selections thus creating a query.
As simple as it should be, I cannot get lstbx2 to list the fields from a table selected in lstbx1.

I have this on Form load:
Private Sub Form_Load()
Dim db As Database, tbl As TableDef
Set db = CurrentDb

For Each tbl In db.TableDefs
If Left$(tbl.Name, 4) <> "MSys" And Left$(tbl.Name, 5) <> "VALID" Then
lstTables.RowSource = tbl.Name & "; " & lstTables.RowSource
End If
End Sub

But I get a null error when I select a table name from list 1

Any ideas would be greatly appreciated!
Reply With Quote