Using CopyObject

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

Guest

I'm trying to set-up a macro where a table will be imported and saved as an
unique table name. I have a variety of Excel tables that are all the same
data but need to be saved as unique tables in Access after importing. I have
a field in the imported tables that has the unique name in it and would like
to simply have the macro use the value in each imported table's field as the
name of the copied object. Is this possible, and if not, is their another
option available?

Thanks!
 
Hi Michelle,

you can do this with VBA code

'~~~~~~~~~~~`
dim mTablename as string
dim mImportTable as string

mImportTable = "CurrentTablename"

mTablename = dLookup( _
"[fieldname]",mImportTable )

Docmd.rename mTablename,actable, mImportTable
'~~~~~~~~~

where
fieldname is the name of the field containing what to call
the new table
"CurrentTablename" is the current name of your import table


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Back
Top