Maybe is better solution, I don't know, but you can try it:
Private Sub Form_Load()
Me.lstTables.RowSource = TdfList
End Sub
Function TdfList() As String
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
If Left(tdf.Name, 4) <> "MSys" Then 'Access system tables
If TdfList <> "" Then
TdfList = TdfList & ";"
End If
TdfList = TdfList & "'" & tdf.Name & "'"
End If
Next tdf
End Function
Aivars --> Thanks. Somehow the only result I could get with your function was a combobox with a string maide of the table names separated by ";". I played around with it a bit and could not figure out how to correctly fill my combobox with it. If you know why and how, let me know.
Mike --> Why (MSysObjects.Type)=6? This didn't return any value. When I removed the criteria, I could see all the entries in MSysObjects. There are no type 6. I used type 1 and supplied a criteria in name cause all my table starts with T as in TEmployee. So I used "T*" as criteria combined with 1 in the type and it works. Thanks
Here's my variation (I use it to show all tables, queries, & reports so you can tweak it for tables):
SELECT MSysObjects.Id, MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Name) Not Like "~*" And (MSysObjects.Name) Not Like "msys*" And (MSysObjects.Name) Not Like "{*")
ORDER BY MSysObjects.Name;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.