Handling Runtime Error 75 when changing a folder name

irish634

Registered User.
Local time
Yesterday, 22:36
Joined
Sep 22, 2008
Messages
230
Hi Everyone,

After some time away from developing databases, I find myself back into it.
In the current database I am developing, I am trying to handle an error. I'm sure it's because I am rusty, but I need some guidance...

I have a combo box that selects the type of action being recorded, and then creates a control number (combo box selection & record id = ex "CA-0001"). Simple enough. Now when this control number is created, I also create a folder named the same (CA-0001) to store supporting documents for the record.

Later in the process, if the manager decides the combo box selection was the wrong category, he can change it. So when he changes the record, the CA-0001 may become RA-0001. I am also changing the associated folder name to correspond to the new control ID.

All of this is fine, and I can make it work well. However, if there is a file open within the folder I am trying to change, I of course get an error (runtime error 75 to be exact).

Now my question is, would this be better handled in the "before update" event, or just handle the error another way? Ultimately, I want to tell the user the record cannot be changed because someone has a file open or something, then stop the update, which is why I think 'before update'. How would you guys handle this?

For data integrity, I know I probably shouldn't allow the control number to change, but I track it with an audit trail, so I am not too worried about that.

Thanks
 
I take it you got this working? Posting your solution could help somebody else.
 
Sorry...

The solution I ended up with was just trapping the error and displaying a message box alerting the user the name can't be changed because a file is open.

Having multiple FE users and not knowing who may have the file open, this was the best solution I could come up with.
 
Another option is having trapped the error, you could create a new folder with the changed name, and copy the files to it. Mark the original folder for deletion and your database could check periodically (on open, or on a timer event) when it could be deleted.
 
Cronk, that would work as long as the opened file that is blocking matters is not opened exclusively. If it IS, it would not be copyable. An exclusive file lock blocks reading, too.
 

Users who are viewing this thread

Back
Top Bottom