>How do you check to see if a file is open without attempting to open it first?
>
>I looked at FOPEN(cFileName, nAttribute) and wonder if this would do the job, or is there more to this? I have done this a long time ago, I think.
The reason TRY/CATCH as Nadya suggests (or ON ERROR in older versions) is best is that too many things can go wrong when interacting with any resource external to your program, like files on disk. For example:
The file may be used by another person.
The file may be R/O. This includes files on a CD.
You may not have enough privileges for the folder or file.
When adding records, disk may be full.
... 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)