Handling Runtime Error 75 when changing a folder name (1 Viewer)

irish634

Registered User.
Local time
Today, 18:58
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
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:58
Joined
Aug 30, 2003
Messages
36,126
I take it you got this working? Posting your solution could help somebody else.
 

irish634

Registered User.
Local time
Today, 18:58
Joined
Sep 22, 2008
Messages
230
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.
 

Cronk

Registered User.
Local time
Tomorrow, 08:58
Joined
Jul 4, 2013
Messages
2,772
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.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:58
Joined
Feb 28, 2001
Messages
27,189
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

Top Bottom