J
James
I have a form that makes a copy of the backend database. The code is below.
However it works fine when I open the database with the shift key, but when
it is open in run mode (not .mde) it gives be an error box that says
"Permission Denied". This is in Access 2000. Anyone know how to fix this
problem.
--------------start code-----------------
Private Sub cmdBackup_Click()
On Error GoTo Err_cmdBackup_Click
FileCopy Me.txtSource, Me.txtDest
MsgBox "Backup Successful.", , "PackageLog 2005"
Exit_cmdBackup_Click:
Exit Sub
Err_cmdBackup_Click:
MsgBox Err.Description
Resume Exit_cmdBackup_Click
End Sub
Private Sub cmdBuildFile_Click()
Dim strFolder As String
strFolder = BrowseFolder("Please select a new folder for the backup file.")
If Not strFolder = vbNullString Then
Me.txtFolderPath = strFolder
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim DataBE, DestinationFile
Dim datenow
datenow = Now()
DataBE = CurrentDBDir & "PLOG2005BE.mdb"
DestinationFile = Me.txtFolderPath & "PLOG2005BE" & Format(datenow,
"mmddyy") & ".bku"
Me.txtSource = DataBE
Me.txtDest = DestinationFile
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
Private Sub txtFolderPath_BeforeUpdate(Cancel As Integer)
txtDest.Requery
End Sub
----------------End Code---------------
However it works fine when I open the database with the shift key, but when
it is open in run mode (not .mde) it gives be an error box that says
"Permission Denied". This is in Access 2000. Anyone know how to fix this
problem.
--------------start code-----------------
Private Sub cmdBackup_Click()
On Error GoTo Err_cmdBackup_Click
FileCopy Me.txtSource, Me.txtDest
MsgBox "Backup Successful.", , "PackageLog 2005"
Exit_cmdBackup_Click:
Exit Sub
Err_cmdBackup_Click:
MsgBox Err.Description
Resume Exit_cmdBackup_Click
End Sub
Private Sub cmdBuildFile_Click()
Dim strFolder As String
strFolder = BrowseFolder("Please select a new folder for the backup file.")
If Not strFolder = vbNullString Then
Me.txtFolderPath = strFolder
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim DataBE, DestinationFile
Dim datenow
datenow = Now()
DataBE = CurrentDBDir & "PLOG2005BE.mdb"
DestinationFile = Me.txtFolderPath & "PLOG2005BE" & Format(datenow,
"mmddyy") & ".bku"
Me.txtSource = DataBE
Me.txtDest = DestinationFile
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
Private Sub txtFolderPath_BeforeUpdate(Cancel As Integer)
txtDest.Requery
End Sub
----------------End Code---------------