Changing the Application Title of a database with code

J

John Ortt

Hi Everyone.

I would like an archiving macro which copied my live database to an archive
folder and changed the application title from "master" to "backup - date"
where "date" is the current date.

I currently do this manually but if it is possible to do it with code that
would be a great timesaver.

I think I have the code to create the copy, but I don't have the code to
change the file name and application title to include the date.

Thanks in advance for any tips,

John.

My attempt at code folllows:
//////////////////////////////////////////

Function ArchiveDB()

If Dir("P:\Archive\Archive.mdb") <> "" Then Kill
"P:\Archive\Archive.mdb"
DBEngine.CompactDatabase "P:\MASTER\MasterDB.mdb",
"P:\Archive\Archive.mdb"

End Function
 
D

Douglas J. Steele

Function ArchiveDB()

Dim dbArchive As DAO.Database

If Dir("P:\Archive\Archive.mdb") <> "" Then Kill
"P:\Archive\Archive.mdb"
DBEngine.CompactDatabase "P:\MASTER\MasterDB.mdb",
"P:\Archive\Archive.mdb"

Set dbArchive = OpenDatabase("P:\Archive\Archive.mdb")
dbArchive.Properties("AppTitle") = "Backup " & Format(Date,
"yyyy-mm-dd")

End Function
 
Top