archiving a table with a date

T

tbmarlie

Hello,

I'm trying to archive a table my moving it to another database and
then adding the current date to the end of it by using the code shown
below.

The table in the current database is "tbl_A20_AcctStatusCurrMo"
The table I would like to archive it to would be called
"AcctStatusCurrMo4-22-08"
The archive database that I would be copying it to is called "Master
Account List.mdb"

Originally I just tried definine a field as type date and then adding
it to the end of the table name, but I got compile errors so I figured
that it needed to be a string so I created a temp table that contains
a date field that is in string format. As it is right now, I get a
Compile error saying "External name not defined" There's probably an
easier way to do this.

Function Archive_Data()

Dim strDate As String

strDate = DLookup("[StringDate]",
"tbl_D10_MakeCurrentStringDateForBackup")

DoCmd.CopyObject ("L:\Master Accounts Archive.mdb"),
["AcctStatusCurrMo"&StrDate], acTable, "tbl_A20_AcctStatusCurrMo"

End Function
 
T

tbmarlie

Hello,

I'm trying to archive a table my moving it to another database and
then adding the current date to the end of it by using the code shown
below.

The table in the current database is "tbl_A20_AcctStatusCurrMo"
The table I would like to archive it to would be called
"AcctStatusCurrMo4-22-08"
The archive database that I would be copying it to is called "Master
Account List.mdb"

Originally I just tried definine a field as type date and then adding
it to the end of the table name, but I got compile errors so I figured
that it needed to be a string so I created a temp table that contains
a date field that is in string format.  As it is right now, I get a
Compile error saying "External name not defined"  There's probably an
easier way to do this.

Function Archive_Data()

Dim strDate As String

strDate = DLookup("[StringDate]",
"tbl_D10_MakeCurrentStringDateForBackup")

DoCmd.CopyObject ("L:\Master Accounts Archive.mdb"),
["AcctStatusCurrMo"&StrDate], acTable, "tbl_A20_AcctStatusCurrMo"

End Function

I was just re-reading my post - the database that I would be copying
to is "Master Accounts Archive". Thanks.
 

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