>*** 02/21/2006 Cecil Champenois. We need to set this up so that the user >*** waits here until the following Production file is able to be opened. >LOCAL lcFileName, lcMessageText AS Character >LOCAL lnSuccess AS Number >#DEFINE NREADWRITE 12 >lcFileName="E:\PRODUCTION\DATA\PRODUCTION.DBF" >lnSuccess=FOPEN(lcFileName, NREADWRITE) >=FCLOSE(lcFileName) Now another user open the table. >IF lnSuccess < 0 > MESSAGEBOX(lcMessageText, 0, lcTitleText) >ELSE > * The file is not being used by anyone so, open it now. > USE (lcFileName) EXCLUSIVE ALIAS PROD_E >ENDIF >use this:
local lnSuccess do while not m.lnSuccess TRY USE (lcFileName) EXCLUSIVE ALIAS PROD_E lnSuccess = .T. CATCH lcMessageText="Field is in use by another user." lcTitleText ="Please wait for file to be available" MESSAGEBOX(lcMessageText, 0, lcTitleText) ENDTRY ....