Ok, my code for my Backup module works well via Copyfile.
Here's what it can do (current):
Backup my Database but using the date function as its filename
Restore my backup file only if the filename is Database.mdb
Here's a screenshot of the prog:
and the backup files:
Note: If I backup my database on the same day, it will just delete the file with the same date.
Heres my code (Backup):
Public Sub DBBackup() 'On Error GoTo err: Dim myFile As New FileSystemObject Dim myTrue As String Dim myTemp As String If myFile.FolderExists(App.Path & "\Backup") = False Then myFile.CreateFolder App.Path & "\Backup" End If Set myFile = Nothing myTrue = App.Path & "\Backup\" & Format$(Date, "mmmm-dd-yyyy") & ".mdb" If myFile.FileExists(myTrue) = True Then myFile.DeleteFile myTrue, True End If myTemp = myTrue & Now - DateValue(Now) & GetTickCount If myFile.FileExists(myTemp) = True Then myFile.DeleteFile (myTemp) End If myFile.CopyFile App.Path & "\Database.mdb", myTrue, False MsgBox "Database Backup Process Complete", vbInformation, "Information" lblCBK.Caption = "Backup process complete." Form2.Enabled = True cmdClose.Enabled = True Exit Sub err: MsgBox err.Description, vbCritical End Sub
Here's what I want the module to do:
At backup, it would rename the file to Database.mdb w/out deleting the file w/ the
same name (if thats possible) or not delete it because of different in time the
backup was created.
It can create a multiple backup a day w/out replacing other files.
Please don't tell me to use Encode/Decode Binary methods.
Thanks in advance.