Below, I have pasted the code I am using to create a backup of my BE.
Is there any way to get the "Browse" feature that windows uses
so that a user can select the location of where they want to save
their backup instead of typing the entire path.
Thanks.
Public Sub Backup_Click()
On Error GoTo Err_Backup
Dim strMsg As String, strTitle As String
Dim strSource As String, strDest As String
Dim strError As String
'
strMsg = "The Backup of the Database was Successful."
strTitle = " Backup Complete"
'
BeginBackup:
' Path where backend database is located
strSource = "C:\Program Files\EZ Accounting\EZ Accounting.mde"
' Destination where data file is to be copied
'strDest = "C:\Program Files\EZ Accounting\EZ Accounting Backup.mde"
strDest = InputBox("Enter Complete Path (Ex: C:\EZ Accounting.mde)"
& vbCrLf & _
"for the location of the backup file.", " Enter Path And File Name")
DoCmd.Hourglass True
FileCopy strSource, strDest
DoCmd.Hourglass False
' Backup has completed - Give Successful Completion Message
MsgBox strMsg, vbInformation + vbOKOnly, strTitle
Exit_Backup:
Exit Sub
Err_Backup:
Select Case Err.Number
Case 61
strError = "The Floppy Disk is full, Cannot Save to this Disk." _
& vbCrLf & vbCrLf & "Insert a New Disk then Click ""OK"""
If MsgBox(strError, vbCritical + vbOKCancel, " Disk Full") = vbOK
Then
Resume BeginBackup
Else
Resume Exit_Backup
End If
Case 70
strError = "The File is currently open." & vbCrLf & _
"The File can not be Backed Up at this time."
MsgBox strError, vbCritical + vbOKCancel, " File Open"
Case 71
strError = "There Is No Disk in Drive" & vbCrLf & vbCrLf & _
"Please Insert Disk then Click ""OK"""
If MsgBox(strError, vbCritical + vbOKCancel, " No Disk") = vbOK
Then
Resume BeginBackup
Else
DoCmd.Hourglass False
Resume Exit_Backup
End If
Case Else
DoCmd.Hourglass False
MsgBox Err.Number & vbCrLf & Err.Description
Resume Exit_Backup
End Select
End Sub
Is there any way to get the "Browse" feature that windows uses
so that a user can select the location of where they want to save
their backup instead of typing the entire path.
Thanks.
Public Sub Backup_Click()
On Error GoTo Err_Backup
Dim strMsg As String, strTitle As String
Dim strSource As String, strDest As String
Dim strError As String
'
strMsg = "The Backup of the Database was Successful."
strTitle = " Backup Complete"
'
BeginBackup:
' Path where backend database is located
strSource = "C:\Program Files\EZ Accounting\EZ Accounting.mde"
' Destination where data file is to be copied
'strDest = "C:\Program Files\EZ Accounting\EZ Accounting Backup.mde"
strDest = InputBox("Enter Complete Path (Ex: C:\EZ Accounting.mde)"
& vbCrLf & _
"for the location of the backup file.", " Enter Path And File Name")
DoCmd.Hourglass True
FileCopy strSource, strDest
DoCmd.Hourglass False
' Backup has completed - Give Successful Completion Message
MsgBox strMsg, vbInformation + vbOKOnly, strTitle
Exit_Backup:
Exit Sub
Err_Backup:
Select Case Err.Number
Case 61
strError = "The Floppy Disk is full, Cannot Save to this Disk." _
& vbCrLf & vbCrLf & "Insert a New Disk then Click ""OK"""
If MsgBox(strError, vbCritical + vbOKCancel, " Disk Full") = vbOK
Then
Resume BeginBackup
Else
Resume Exit_Backup
End If
Case 70
strError = "The File is currently open." & vbCrLf & _
"The File can not be Backed Up at this time."
MsgBox strError, vbCritical + vbOKCancel, " File Open"
Case 71
strError = "There Is No Disk in Drive" & vbCrLf & vbCrLf & _
"Please Insert Disk then Click ""OK"""
If MsgBox(strError, vbCritical + vbOKCancel, " No Disk") = vbOK
Then
Resume BeginBackup
Else
DoCmd.Hourglass False
Resume Exit_Backup
End If
Case Else
DoCmd.Hourglass False
MsgBox Err.Number & vbCrLf & Err.Description
Resume Exit_Backup
End Select
End Sub