$SETBOUT not refreshing all the time?

I'm using the following code in the SPEPOH script, which checks if the purchase order is fully signed. If so, the delete button should be disabled.

It works sometimes, however when I select a different order in the left menu that is fully signed and receipted, then back to an order that is only fully signed, it allows me to delete, until I select the item from the list again?

Any ideas why this would be happening?

The following is the code used:


$SETBOUT
  If [F:POH]APPFLG = 3 and [M:POH1]APPFLG = 3
    Disable GSTAANU
  Elsif [F:POH]APPFLG <= 2 and [M:POH1]APPFLG <= 2
    Enable GSTAANU
  Endif
Return