Using Variables with CopyObject

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

Guest

I'd like to automatically copy tables to another database for archiving purposes, and to rename them on the way to reflect the date created (as in 'Names20032004')

I'd like to use CopyObject to transfer the tables, using a variable formed from a name constructed from the original name and dates, but I can't get CopyObject to accept my variables

the line I have constructed is:
DoCmd.CopyObject [F:\[Monitor archive]\[practice archive].mdb], archtablename, acTable, "names
where 'archtablename' is my new naming construction, and 'names' is the existing table

Where am I going wrong

Stev
 
The destination database must be sent as a string, so try this:

DoCmd.CopyObject "F:\Monitor archive\practice archive.mdb", archtablename,
acTable, "names"

This assumes, of course, that you have actually assigned some value to the
archtablename variable.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org


Steve M. said:
I'd like to automatically copy tables to another database for archiving
purposes, and to rename them on the way to reflect the date created (as in
'Names20032004').
I'd like to use CopyObject to transfer the tables, using a variable formed
from a name constructed from the original name and dates, but I can't get
CopyObject to accept my variables.
the line I have constructed is:
DoCmd.CopyObject [F:\[Monitor archive]\[practice archive].mdb],
archtablename, acTable, "names"
 
Back
Top