Command1_click

By | 2002-06-01

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

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.