|
|
|
|
|
|
Access
|
Create current daily backup of linked data files
|
|
Ease of Use
|
Easy
|
Version tested with
|
2003
|
Submitted by:
|
mdmackillop
|
Description:
|
The code makes a copy of the file containing the tables etc linked to the database to a different folder for each day of the week
|
Discussion:
|
Where your data is critical and you need it readily available, this code will maintain a current copy for each day of the week in the "spare" space on your disk. Previous copies on any day will be overwritten.
The code can be linked to the Quit button as shown, or to any other suitable event.
|
Code:
|
instructions for use
|
Option Compare Database
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Backsup
DoCmd.Quit
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Sub Backsup()
Dim SourceFile, DestinationFile
SourceFile = "C:\Data\MyData.mdb"
DestinationFile = "C:\Data\" & Format(Now(), "dddd") & "\MyData.mdb"
FileCopy SourceFile, DestinationFile
End Sub
|
How to use:
|
- Copy the Backsup code above and paste it into the code module of your form
- Add the Backsup line to the event that you wish to run the code.
|
Test the code:
|
- Extract the sample folder onto the C Drive. This will create a folder called Data with seven subfolders
- Open TestFile.mdb
- Click on the "Quit App and Backup" button
- This will create a copy of MyData.mdb into the folder with the name of the day.
|
Sample File:
|
Data.zip 32.79KB
|
Approved by Jacob Hilderbrand
|
This entry has been viewed 83 times.
|
|