I have code in my front end that opens a form for backing up the front end.
I'll give a brief description of what the form does:
1) When the backup form opens, it closes all open forms except for three
hidden forms and the backup form itself.
2) It automatically creates a backup name for the front end and displays the
folder where it will be backed up.
3) The user clicks the backup button and the following code executes:
************************************************** ************************************************** *********
Public Function Database_Backup(Database As String, BackupFileName As String)
As Boolean
On Error GoTo Err_Database_Backup
Dim blnComplete As Boolean
Dim fso As Object
blnComplete = False
Set fso = New Scripting.FileSystemObject
If Len(Dir(Database)) = 0 Then
MsgBox "The requested database file does not exist.", vbOKOnly +
vbInformation
Else
fso.CopyFile Database, BackupFileName, True
blnComplete = True
End If
Exit_Database_Backup:
Set fso = Nothing
Database_Backup = blnComplete
Exit Function
Err_Database_Backup:
If Err.Number = 70 Then
MsgBox "You cannot backup " & Database & " because it is opened
exclusively by another user." & vbCrLf & _
"If you're trying to write the file to a CD, you'll have to do that
from Explorer.", vbOKOnly + vbExclamation Else
MsgBox Err.Number & " - " & Err.DESCRIPTION, vbOKOnly + vbExclamation
End If
Resume Exit_Database_Backup
End Function
************************************************** ************************************************** *********
Now after six months, I'm having second thoughts as to whether this method
will always work correctly. As far as I know, I haven't had any problems and
I probably average two to three backups per day. It's just that my app is
now so large (170+ forms, 120+ tables), there is no way I can test all of the
functionality of a backup copy.
What precipitated the second thoughts is that I have recently added two
additional hidden forms for sending system messages and for forcing a logoff.
My concern is that I now have four forms open when the front end is copied.
That would be the hidden startup form, two other hidden forms and the backup
form itself, of course. I could, close the two new hidden forms, and then
reopen them. I guess, now that I think about it, I could even close the
startup form just before the filecopy and then load it again after the
filecopy occurs. This would go through the whole startup process again, but
I don't think this would be a major problem.
Any comments on my method and what I'm doing. I just want to make sure that
what I'm doing isn't going to cause me corruption problems or any other type
of problem.
Thanks.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200604/1