Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming a file 2

Status
Not open for further replies.

moremon

Technical User
May 31, 2001
3
US
I would like to create a form that would copy and existing (sample) table and renames it. The new name being the current date.

Thanks
 
This is what you want to do

1) Create a Form with a text box (txtTable) where user can type in Table Name he wants to copy
2) Put a command button on the form
3) On Click event of thye Command Button put this code

DoCmd.CopyObject , date, acTable, txtTable


That should do it.
Good luck!
 
if you have the current date on the form (txtTodayDt), you could take that txtbox and put it in the right format (in my case):
txtCharDt = Format(txtTodayDt, "mmddyy")

tblToday = "tbl" + txtCharDt

DoCmd.CopyObject , "tblToday", acTable, tblSample

where tblToday is the new name and tblSample is the table to be copied.

hope this helps
 
You don't need to create another text box to get the current date, like kerrigirrl says. You get the date with the Date() function at the same time as you copy the object.

The only thing you might want to do is Format you current date, in case you don't know the system regional settings

DoCmd.CopyObject , Format(date,"mm/dd/yy"), acTable, txtTable





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top