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
Next
End Sub
But I get a null error when I select a table name from list 1
Any ideas would be greatly appreciated!
|