>>>>How do I check if a dbf is already open?
>>>
>>>Do you mean by the current user, or by other users? For the current user, see Used() and Aused() in help. For other users, try to open the dbf exclusive.
>>
>>Thanks
>
>You're welcome.
>
>Update: While Used() can tell you if a dbf is open or not, Select() can tell you in which work area it's open, 0 means that it's not open. Unless you use Alias, that is.
USED() and AUSED only in current datasession. If you work with multiple datasessions you need to check any datasession in ASESSIONS() with AUSED() like
USE E:\SE\tmp\ut\xyz.DBF ALIAS baeh
?Is_DBF_Used('baeh')
?Is_DBF_Used('xy')
?Is_DBF_Used('xyz.DBF')
?Is_DBF_Used('E:\SE\tmp\ut\xyz.DBF')
FUNCTION Is_DBF_Used
LPARAMETERS;
lcDBF
LOCAL;
lnSession AS INTEGER,;
llUsed AS BOOLEAN
LOCAL ARRAY;
laSessions(1,1),;
laUsed(1,1))
FOR lnSession = 1 TO ASESSIONS(laSessions)
llUsed = AUSED(laUsed,lnSession,lcDBF)>0
IF llUsed THEN
EXIT
ENDIF
ENDFOR
RETURN llUsed
ENDFUNC
:)
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]