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

R

rotor

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.
 
K

Ken Snell

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top