Allows you to backup a source file and have the destination file name be the current date. Great for database backups!
Original Author: Daniel Bennington
Assumptions
Create a new form, create a field called text1 and a field called text2. Also create a command button called command1.
Change Source directory to your database directory name, change source file name to your database name, and change the destination directory name to the location you want the database file backed up to..
Code
- Put this on form load...
Private Sub Form_Load()
Dim MyDate
MyDate = Format(Date, "dddd, mmm d yyyy")
Text1.Text = "C:SourceDirectorySourceFile.mdb"
Text2.Text = "C:DestinationDirectory" + MyDate + ".mdb"
- Put this on Command1 Click...
Private Sub Command1_Click()
FileCopy Text1.Text, Text2.Text