Getting a list of forms, tables, and queries into a combo box

cawillwe

Registered User.
Local time
Today, 16:42
Joined
May 8, 2001
Messages
12
I'm trying to get 2 combo boxes to populate:
1. Has a list of all tables and queries in the database
2. Has a list of all forms

The first one is working, but may be a little sloppy:
Me.TableName.RowSource = ""
For Each tabledef In CurrentDb().TableDefs
If Left(tabledef.Name, 4) <> "MSys" Then
Me.TableName.RowSource = Me.TableName.RowSource & tabledef.Name & ";"
End If
Next
For Each querydef In CurrentDb().queryDefs
If Left(querydef.Name, 4) <> "~sq_" Then
Me.TableName.RowSource = Me.TableName.RowSource & querydef.Name & ";"
End If
Next

The second is not working, and the code I have now is below:
Do While i < Application.Forms.Count
If Left(Application.Forms(i).Name, 9) <> "frmSearch" Then
Me.FormToOpen.RowSource = Me.FormToOpen.RowSource & Application.Forms(i).Name & ";"
End If
i = i + 1
Loop

Any help, especially on the 2nd box, would be greatly appreciated. Thanks
 
I should mention that the reason it checks for Left(Forms(i).Name,9) is to exclude the forms "frmSearch" and "frmSearches," which I have created in the database.
 

Users who are viewing this thread

Back
Top Bottom