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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use tabel Create Date to name Archive copy 1

Status
Not open for further replies.

sdannerr

Technical User
Jul 15, 2003
10
US
I am looking for a way to copy a table and give it a name containing the date the table was created. Can someone help me figure out the code necessary to do this.

Here's some more background...
I have a table called CurrentData which contains the most recent upload of data from our G/L system. I would like to be able to automate the process of uploading data and still keep the previous version in a separate file. So if I currently have data uploaded on 7/25/03, I would like to save it off to a new table named 072503 and then delete the CurrentData table and recreate it with a data import. I have the import working in code but cannot figure out how to save the archive copy of the data.

 
Hi sdannerr,

If you have the creation of your new table all sorted out, probably the easiest thing to do is just to rename the old table beforehand to stop it being overwritten ..

Code:
Dim db As DAO.Database
Dim tb As DAO.TableDef
Dim pr As DAO.Property

Set db = CurrentDb
Set tb = db.TableDefs!
Code:
YourTable
Code:
Set pr = tb.Properties!DateCreated
Code:
' Do whatever manipuation you like with the created date
' This example just uses it as is
Code:
tb.Name = pr.Value 

Set pr = Nothing
Set tb = Nothing
Set db = Nothing

Enjoy,
Tony
 
That definitely does the trick. Thanks for your help.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top