Using Variables with CopyObject

S

Steve M.

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
 
R

Roger Carlson

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"
 

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