Steve
You can set up a dummy ON ERROR routine to trap an error and then restore the original error routine afterwards. eg:
cOrgError = SET("ERROR")
lError =.F.
ON ERROR lError = .T.
USE FILE EXCLUSIVE
ON ERROR &cOrgError
IF !lError
ELSE
ENDIF
There are various ways to use this technique eg in a loop for x times or untill success, etc. In VFP8 you can be more sophisticated using the TRY...CATCH...FINALLY construct.
-
Use < pre > and < /pre > to highight code - no spaces.
>I have a bit of code that inserts a record into a table. The problem is that there is an external program, that i did not write, that requires exclusive use of that table. occasionally there is an error, when they bump heads.
>
>I would like to add some sort of trap that would test to see if the table is available at that moment, if it's not then try again several times before erroring out or succeeding.
>
>********************************
>Insert into 'i:\data\ecnc\data\bcexclusive.dbf' (fnction, forg_date, ;
> forg_time, fdate, ftime, fempno,;
> fjobno, foperno, fcompqty, fscrpqty, flead, fsetup, frework);
> values (cFunction, cdate, cOrg_Time,;
> cdate, cTime, cEmpNo,;
> cJobNo, cOpNo, nCompleted, 0, 'Y', cSetup, 'N')
>use in bcexclusive &&Close table. bcposting needs exclusive use
>*********************************
>
>Oh, by the way, how do i highlight my code above, for the post here on UT?
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.