Macro to copy a table within an mdb file

  • Thread starter Thread starter Laura
  • Start date Start date
L

Laura

Hi,

I have an MDB file that contains a table named "default". I'm opening this
with VBA code from MS Word using ADO.

I'd like to be able to create a COPY of my "default" table, giving it a new
name. Then pump data into the new table/record set.

I'd also like to be able to list all the current tables in the database
file.

The code I'm using to access the database is:

Dim dbList As DAO.Database, RecSet As DAO.Recordset, sDBPath As String
rsName = "Test File"
sDBPath = "c:\UserDefined.mdb"

'open database file
Set dbList = OpenDatabase(sDBPath, ReadOnly:=False)

'open the appropriate table --
Set RecSet = dbList.OpenRecordset("default")

But I'm at a loss for how to save the "default" record set as a new table
within the database.

Any help on this, or how to list all tables in the database would be greatly
appreciated!
Many Thanks,
Laura
 
I've figured most of this out. What I'm doing to "copy"
the table, is create a new one, and then make fields for
it matching those in the old one.

For listing the user defined tables, I'm listing all the
tabledefs in the database except those starting
with "MySys."

If anyone has any better ideas, I'd love to hear them,
but this seems to be working for now.

-----Original Message-----
Hi,

I have an MDB file that contains a table
named "default". I'm opening this
 
Back
Top