>Hello, I have a document management module of my application and part of it requires taking file MyFile.txt and renaming it to Last_Name_First_Name_Date.txt.
>
>I use the VFP Rename function and trap for the existence of the source and also the destination, but get caught up in situations where the user has the file open ...
>
>Anybody have any suggestions on how to handle this type of situation (or similar ones while we're at it, like maybe the original file is read-only, etc.)
>
>Thanks
>
>Kevin
Any interaction with things outside your program should use TRY...CATCH, since you can't foresee what can go wrong. In the case of opening a file, for example, you might have the following problems:
Filename is wrong
File is R/O
No access rights
Local or network disk not available
Error reading file
... and probably a few more.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)