rename or copyobject with user-defined name?

  • Thread starter Thread starter R
  • Start date Start date
R

R

I want to allow my user to define a new name for a copied or renamed table -
the process is run from a macro. I see that the new name is a required
argument.

Is there any way to set a variable in the new name so I can prompt the user
for a name? Ideally the name would always be "RAD" & [date], so even if I
could get the date in the new name withOUT prompting the user would be
wonderful.

Thoughts?
 
Hi,

the following piece of VBA code will do what you need:

DoCmd.CopyObject , "RAD" & Date(),
acTable, "OriginalTableName"

It will copy the table (OriginalTableName) into a new
table called RAD followed by todays date. If you want to
include the time use Now() instead of Date().

hth

chas
 
Back
Top