How can I obtain a list of tables in the current database?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using VBA in Access XP with Win 2k

Does anyone know how I can copy a list of table names in the current database into an array

If so, can you please post example code? Thanks much in advance.
 
Try this untested code:

Dim dbs As DAO.Database
Dim strTableNames() As String
Dim lngLoop As Long, lngCount As Long
Set dbs = CurrentDb
lngCount = dbs.TableDefs.Count -1
ReDim strTableNames(0 To lngCount) As String
For lngLoop = 0 To lngCount
strTableName(lngLoop) = dbs.TableDefs(lngLoop).Name
Next lngLoop
dbs.Close
Set dbs = Nothing
 
Back
Top