I have a code segment that is occasionally logging an error. The
segment is below:
IF USED(gcsnapshot)
USE IN (gcsnapshot)
ENDIF
ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
ERASE (gctempdir + 'snap' + gcuserid + '.fpt')
gcsnapshot is the alias for the table gctempdir\snapgcuserid.dbf. I
believe that this table is closed in the first segment of code and then
the intent is to delete the table prior to exitting.
The error being logged is "file is in use" and it nominates a file that
is actually open as the returned value from DBF() which is called in my
error handler. The error handler gets called 3 times and nominates the
line numbers for each of the erase commands as the line numbers for the
errors.
In my error handler I do a LIST STATUS and nowhere in the status output
is there a reference to the "snap" files so I am assuming that the file
is in fact closed and so it should be erasible.
I am wondering if the erase is being attempted before the table is
actually closed and so logging the error (and the reference to the other
file is just an artifact of the state of the application at the time).
If that is the case what can I do to delay the execution of the erase
commands until after the table is closed properly?
This is in VFP 7
thanks
pete