Backup Permission Denied Error (A97)

  • Thread starter Thread starter Winnetou
  • Start date Start date
W

Winnetou

I created a function to back up all linked BE databases. Among other
things, the function closes any open forms before it invokes the
FileCopy statement.

The function works fine from the debug window. However, when the
function is called from a command bar button, I get a Permission
denied error (Error 70).

I tried to add a 1 s timeout to no avail. What could explain this
behavior? Does the command bar somehow prevent forms from closing or
does it keep some locks open?

Thanks for any suggestions.

Mark
 
Maurice, here it goes:

In a nutshell, CollTbls returns a pointer to the paths of all linked
tables, fParseTblName extracts the table name from the path. The
function executes flawlessly from the debug window but fails when
invoked from a commandbar button.

Meanwhile, I checked again the Knowledge base. In article 207703, MS
provides two methods to correct this behavior (cause: file open). The
api solution seems to have cured the problem.

But I am still puzzled. Thanks for your insights.

Mark

Function fBackup()
On Error GoTo Err_fBackup

Call CloseForms(Me.Name) 'Closes all forms except current (frmBackup).
....
Set collTbls = fGetLinkedTables 'Returns paths of all linked tables
strBkupPath ="C:\Back-up"
For i = collTbls.Count To 1 Step -1
strSrc = collTbls(i): strDest = strBkupPath & "\" _
& fParseTblName(collTbls(i))
FileCopy strSrc, strDest
Next
....
Exit Function

Err_fBackup
Call MsgBox("Error: " & Err.Description, vbInformation, "Error")
End Function
 
Back
Top