>* THE TABLE table1 HAS ONLY THE FIELD flag, NO INDEX AND NO DATA BUFFERING > >SET REFRESH TO 0,-1 > >USE Table1 SHARED > >DO WHILE .t. > > GOTO RECORD RECNO("Table1") > > IF Table1->flag > > IF MESSAGEBOX("Routine is being used by another user",5)=2 > EXIT > ELSE > LOOP > ENDIF > > ELSE > > * Flag to warn that the routine is being used > REPLACE Table1->flag WITH .T. > > IF MESSAGEBOX("Routine is being used by me",1)=2 > EXIT > ENDIF > > * Routine no longer being used by any users > REPLACE Table1->flag WITH .F. > > IF MESSAGEBOX("Routine no longer being used",1)=2 > EXIT > ENDIF > > ENDIF > >ENDDO > >REPLACE Table1->flag WITH .F. >USE > >SET REFRESH TO 0,5 > >You aren't going to get a return value of 2 from MESSAGEBOX(). (Personally I always use the defined constants from foxpro.h for more readable code. I hate "magic numbers").