Lutz,
there used to by a very sporadic error under vfp6 until vfp8, which drove me mad - and was supposedly fixed in vfp9 by Aleksey T.
It resulted in the table to be opened, but under a different alias - which could not be guessed at.
I had about 4 screens of code checking for, logging and fixing such events (loop if alias was not opened with correct table after few doevents, similar to Naoto) and caught a couple of dozen every week (full time running of 6 workstations munging big-iron data, running more than a few million calls to USE).
In vfp8 Aleksey found the error could be avoided in by running a local or private command establishing an entry for the alias in mem,
like
function use_safe(tcAlias)
local &tcAlias
USE (m.tcAlias) IN SELECT(m.tcAlias)
sidestepping the pages of errorhandling code (I kept for several years in a branch stepped over, at first via goApp.Property (to be able to set dynamically), later via #define to keep safety net in source code, but out of normal compile stuff. With Vfp9 SP2 the Local &tcAlias was not compiled any more as well, IIRC. He explained it was a timing/race problem in updating internal data structures.
First order of business is/was to verify in all open tables have intended alias by looping through all workareas with
iif(len(alias(lnWA) +":"+dbf(lnWA))>1, check_log_WA(lnWa), .t.)
or quick check in debugger if error is caught on dev machine. Also any security/AV scanning dbf/cdx/fpt was not envisioned by trying to squeeze more speed into vfp table handling...
blast from the past
thomas
>
>USE MyTable IN SELECT('MyTable')
>
>syntax for a while
>On some strange moments
>I receive error 3
File is in use>
>What I see
>Prog is in a workarea without open cursor
>MyTable is open shared in an other workarea
>DATABASE is set correctly, SET DEFAULT points to the path of the database, only one database is open.
>A CA that uses this table and might write to it is open
>
>The line is normally running fine, but sometimes it fails.
>
>Any idea why?
>I know I can circumvent the very place, but to do this on ever in every place I use IN SELECT(). Ouch