>I'm sending some data to a file with a Copy To statement, but because I've got a prior version of the file open in another program, VFP gives me a "file access denied" (1705) error, which is not handled by the MM framework, so I'm dumped out of the app.
>
>I'd like to trap the error when I do the Copy, and return an error indication to the calling method.
>
>What's the best way to handle this situation? I could:
> - change the form's Error method to handle a 1705, but how do I then let the method with the Copy know an error occured?
> - put an On Error statement before the Copy statement to set a flag if an error occurs on the Copy, and then check the flag. Are there any errors that could happen in a Copy that I wouldn't want to treat as an error here?
>
>Any other ideas or thoughts?
>
>Thanks,
>
>June
Which VFP version you're using? If VFP* and above, you can use TRY/CATCH.
If it's not broken, fix it until it is.
My Blog