When I try to load a new value into a variable it keeps the old value.  I'm 
using a timer eep and a select statement to get the value.  In one session I 
run the form with this code.  In another session I make a change and save it.  
I've left the form and reentered to confirm the saved change.  The value 
displayed in the pause message through the timer eep though is the same.  Is 
there some other command that needs to be issued to update the variable value?


.--Code to get values
clear var fAllowIn, fOkayToBeInBGU

set var fAllowIn datetime = null
set var fOkayToBeInBGU text = null

 SELECT AllowIn, OkayToBeInBGU, KeepStaffOutBGURecNo  +
      INTO fAllowIn INDICATOR fiAllowIn, +
      fOkayToBeInBGU INDICATOR fiOkayToBeInBGU, +
      fKeepStaffOutBGURecNo INDICATOR fiKeepStaffOutBGURecNo +
      FROM KeepStaffOutBGU +
      WHERE ForceOut = .fForceOut


--Message to show value returned.  The correct value for .#Now is returned but 
.fAllowIn is always the same.
 pause 4 using .#now caption .fAllowIn




--Complete Code
pause 4 using .#now caption 'OkayToBeIn'

SELECT MAX (ForceOut) +
     INTO fForceOut +
     INDICATOR fiForceOut +
     FROM KeepStaffOutBGU +
     WHERE ForceOut <= .#Now

IF fForceOut <= .#Now THEN
clear var fAllowIn, fOkayToBeInBGU

set var fAllowIn datetime = null
set var fOkayToBeInBGU text = null

 SELECT AllowIn, OkayToBeInBGU, KeepStaffOutBGURecNo  +
      INTO fAllowIn INDICATOR fiAllowIn, +
      fOkayToBeInBGU INDICATOR fiOkayToBeInBGU, +
      fKeepStaffOutBGURecNo INDICATOR fiKeepStaffOutBGURecNo +
      FROM KeepStaffOutBGU +
      WHERE ForceOut = .fForceOut

 SET VAR vUserTest = (ChkVar('vUser'))

 IF vUserTest = 0 OR vUser IS NULL THEN
  SET VAR vUser = (CVAL('NetUser'))
 ENDIF

 SELECT COUNT (*) +
      INTO vCount +
      INDICATOR viCount +
      FROM KeepStaffOutBGUException +
      WHERE KeepStaffOutBGURecNo = .fKeepStaffOutBGURecNo +
      AND StfMbrException = .vUser

 IF vCount > 0 THEN
  CLS
 ELSE
  pause 4 using .#now caption .fAllowIn

  IF fAllowIn IS NULL OR fOkayToBeInBGU IS NULL THEN
   --PAUSE 4 USING 'variable is null'
  ELSE
   IF fAllowIn <= .#Now AND fForceOut <= .#Now THEN
    --PAUSE 4 USING .fOkayToBeInBGU
   ELSE
    IF (fAllowIn >= .#Now AND fForceOut <= .#Now +
          AND fOkayToBeInBGU = 'Y') THEN
     --PAUSE 4 USING 'It is okay to use BGU.'
    ELSE
     GETPROPERTY APPLICATION ISCOMPILED 'fIsCompiled'

     IF fIsCompiled = 'Yes' THEN
      PAUSE FOR 4 USING +
           'BGU is under construction.  Please, try again later.' +
           OPTION MESSAGE_FONT_NAME Times New Roman +
           |MESSAGE_FONT_COLOR 0 +
           |MESSAGE_FONT_SIZE 12

      --edit using Message
      EXIT
     ELSE
      PAUSE 4 USING 'Hello'
     ENDIF

    ENDIF
    --fAllowIn >= .#Now AND fForceOut <= .#Now AND fOkayToBeInBGU = 'Y'
   ENDIF --fAllowIn > .#Now and fForceOut <= .#now
  ENDIF --fAllowIn is null or fOkayToBeInBGU is null
 ENDIF --vCount > 0
ENDIF --fForceOut <= .#Now

--CLOSEWINDOW
RETURN

Reply via email to