A
Afrosheen via AccessMonster.com
Thanks for reading this post. It's really appreciated.
I have a form that has a "backup" command button.
The complete code is below. It is at line 60 where my question is. What I
want to do is to backup another database. It is separate from the one this
form/database uses.
I was wondering if I could use:
strcopyfile = f:\db2 & "\Copy of " & f:\db2
Private Sub cmdtoggle_Click()
Dim strSQL
Dim strcopyfile, strSQL1 As String
On Error GoTo cmdtoggle_Click_Error
10 strSQL1 = "Update tblbackup set tblbackup.fcopy = False"
20 CurrentDb.Execute strSQL1, dbFailOnError
' *** Save the backup date ***
40 strSQL = "UPDATE tblbackup SET tblbackup.bkdate = now()"
50 CurrentDb.Execute strSQL, dbFailOnError
-----> '*** Defines the Backup Name ***
-----> 60 strcopyfile = CurrentProject.Path & "\Copy of " &
CurrentProject.Name
'*** Checks to see if there is a back up. If so then
deletes it ***
70 If Len(Dir(strcopyfile)) > 0 Then
80 Kill strcopyfile
90 End If
'*** Makes a backup copy & closes the frmBKBox ***
100 fMakeBackup
110 Me.Parent.ENTERBUTTON.SetFocus
120 Forms("frmPersonnel_Menu")!frmbkbox.Visible = False
130 Exit Sub
On Error GoTo 0
Exit Sub
cmdtoggle_Click_Error:
Err.Description = Err.Description & " In Procedure " & "cmdtoggle_Click
of VBA Document Form_frmBkBox"
Call LogError(Err.Number, Err.Description, "cmdtoggle_Click")
End Sub
I have a form that has a "backup" command button.
The complete code is below. It is at line 60 where my question is. What I
want to do is to backup another database. It is separate from the one this
form/database uses.
I was wondering if I could use:
strcopyfile = f:\db2 & "\Copy of " & f:\db2
Private Sub cmdtoggle_Click()
Dim strSQL
Dim strcopyfile, strSQL1 As String
On Error GoTo cmdtoggle_Click_Error
10 strSQL1 = "Update tblbackup set tblbackup.fcopy = False"
20 CurrentDb.Execute strSQL1, dbFailOnError
' *** Save the backup date ***
40 strSQL = "UPDATE tblbackup SET tblbackup.bkdate = now()"
50 CurrentDb.Execute strSQL, dbFailOnError
-----> '*** Defines the Backup Name ***
-----> 60 strcopyfile = CurrentProject.Path & "\Copy of " &
CurrentProject.Name
'*** Checks to see if there is a back up. If so then
deletes it ***
70 If Len(Dir(strcopyfile)) > 0 Then
80 Kill strcopyfile
90 End If
'*** Makes a backup copy & closes the frmBKBox ***
100 fMakeBackup
110 Me.Parent.ENTERBUTTON.SetFocus
120 Forms("frmPersonnel_Menu")!frmbkbox.Visible = False
130 Exit Sub
On Error GoTo 0
Exit Sub
cmdtoggle_Click_Error:
Err.Description = Err.Description & " In Procedure " & "cmdtoggle_Click
of VBA Document Form_frmBkBox"
Call LogError(Err.Number, Err.Description, "cmdtoggle_Click")
End Sub