Feb 21, 2003 #1 chris9 Programmer Feb 11, 2003 32 US Does anyone know if there is a function that can List all the Tables you have in one Database?
Feb 21, 2003 #2 Rick39 Programmer May 11, 2001 426 US As a query: SELECT MSysObjects.Database, MSysObjects.Connect, MSysObjects.Name, MSysObjects.Type FROM MSysObjects WHERE (((MSysObjects.Type)=6)); or: Sub ListTables(strDbPath As String) ' This procedure lists the tables in a database. ' Arguments: ' strDbPath: The path to the database. Dim dbs As DATABASE, tdf As TableDef Set dbs = OpenDatabase(strDbPath) For Each tdf In dbs.TableDefs Debug.Print tdf.NAME Next tdf dbs.close Set dbs = Nothing End Sub Upvote 0 Downvote
As a query: SELECT MSysObjects.Database, MSysObjects.Connect, MSysObjects.Name, MSysObjects.Type FROM MSysObjects WHERE (((MSysObjects.Type)=6)); or: Sub ListTables(strDbPath As String) ' This procedure lists the tables in a database. ' Arguments: ' strDbPath: The path to the database. Dim dbs As DATABASE, tdf As TableDef Set dbs = OpenDatabase(strDbPath) For Each tdf In dbs.TableDefs Debug.Print tdf.NAME Next tdf dbs.close Set dbs = Nothing End Sub
Feb 21, 2003 #3 nealvenables Programmer Jun 27, 2002 141 GB Something along these lines...? Public Sub ListTables() Dim daoDB As DAO.Database Dim daoTDF As DAO.TableDef Set daoDB = CurrentDb() For Each daoTDF In daoDB.TableDefs Debug.Print daoTDF.name Next daoTDF End Sub Upvote 0 Downvote
Something along these lines...? Public Sub ListTables() Dim daoDB As DAO.Database Dim daoTDF As DAO.TableDef Set daoDB = CurrentDb() For Each daoTDF In daoDB.TableDefs Debug.Print daoTDF.name Next daoTDF End Sub