G
Guest
I'm trying to create a combo box that contains the list of tables and queries
in my database. Once the user selects a table or query, I then want to
populate a second list box to display all the fields for the table/query
selected in the first combo box. I'm using Access 2000. I have the following
function that returns a list of the current tables/queries, though it returns
some internal tables which I'd want to exclude.
Dim mylist As String
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
mylist = ""
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllTables
mylist = IIf(Nz(mylist) = "", mylist, mylist & "; ") & "Table: "
& obj.Name
Next obj
For Each obj In dbs.AllQueries
mylist = IIf(Nz(mylist) = "", mylist, mylist & "; ") & "Query: "
& obj.Name
Next obj
mytablesandqueries = mylist
I'm having trouble (a) setting the row source of the first combo box to the
list of tables and queries and (b) excluding the internal tables. Can anyone
help?
Thank you,
Gwyn
in my database. Once the user selects a table or query, I then want to
populate a second list box to display all the fields for the table/query
selected in the first combo box. I'm using Access 2000. I have the following
function that returns a list of the current tables/queries, though it returns
some internal tables which I'd want to exclude.
Dim mylist As String
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
mylist = ""
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllTables
mylist = IIf(Nz(mylist) = "", mylist, mylist & "; ") & "Table: "
& obj.Name
Next obj
For Each obj In dbs.AllQueries
mylist = IIf(Nz(mylist) = "", mylist, mylist & "; ") & "Query: "
& obj.Name
Next obj
mytablesandqueries = mylist
I'm having trouble (a) setting the row source of the first combo box to the
list of tables and queries and (b) excluding the internal tables. Can anyone
help?
Thank you,
Gwyn