Backup - Permission Denied

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

Winnetou

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

The function works fine from the debug window regardless of how many
forms are open. When some forms are left open and the function is
called via a command bar button, I get a Permission denied error
(Error 70). When the forms are closed manually however, and I click on
the Backup command bar button, the backup function works fine again. I
noticed that after a permission error is issued and I click again on
the command bar button, the backup proceeds flawlessly again!

I am really puzzled. I tried to add timeouts to no avail. What could
explain this behavior? Could the command bar somehow prevent forms
from closing. Does it keep some locks open?

Thanks for any suggestions.

Mark
 
Can you show us the code that is closing the forms? I suspect that you are
leaving forms open by stepping through the forms collection from 0 to the last
form.

You should be using something like THE UNTESTED Code below

While DbCurrent().Forms.Count > 0
Docmd.Close acForm, dbCurrent().Forms(0).Name
Wend
 
Back
Top