Just curious if there are more efficient ways of going about this. I would like to populate a combobox with a list of all the tables in the database.
Is there a built in command that I overlooked?
It's fine for now because there's not many tables, but I'm planning to use the same algorithm to populate a second combobox listing all the fields in the table (which can be quite long).
Code:
Function AllTables()
Dim db As Database
Dim tbl As TableDef
Dim strTable As String
Set db = CurrentDb()
strTable = ""
For Each tbl In db.TableDefs
If Left(tbl.Name, 4) <> "msys" Then
strTable = strTable & "'" & tbl.Name & "';"
End If
Next tbl
AllTables = strTable
End Function
cboTable.RowSourceType = "Value List"
cboTable.RowSource = AllTables
Is there a built in command that I overlooked?
It's fine for now because there's not many tables, but I'm planning to use the same algorithm to populate a second combobox listing all the fields in the table (which can be quite long).