Other causes of VB6 trappable error path / file error (error 75)?

In addition to those listed at Microsoft here .

10 DBEngine.CompactDatabase Dbpath, DbTempPath, "", dbEncrypt 20 Kill Dbpath 30 Name DbTempPath As DbPath 

The above code works day after day in many installations, but in extreme cases, line 30 fails and I get a call that is not in the database.

Today I first saw that this happened myself and the error that was thrown:

Error accessing path / file (error 75)

However, I do not think that any of these reasons apply in this situation.

When this happened during the installation today, I renamed the temporary file and ran the code again, and the error occurred again.

(I think this may have something to do with the hardware problem, since creating a copy of the file took a very long time.)

+4
source share
2 answers

There is not enough information here, but I assume that the problem is that your KILL instruction does not end before the NAME statement is executed. It was never clear to me, but it seems that the Windows NT file system has the ability to perform some file operations (especially for large files) asynchronously, so KILL may not be completed by NTFS, although VB6 considers it to be and went to the NAME expression .

It is probably best to put some kind of check after KILL to make sure the file is really gone before starting the rename with NAME .

+3
source

I'm not sure why the problem arose, but you can add a workaround by calling DoEvents or write a short procedure to wait a second or three (or more) to allow time to complete the deletion process or access to release the file.

A more sophisticated workaround would be to write a function to check if the file is accessible before calling the rename.

+2
source

All Articles