Use the OnObjectKeyStroke trigger and trap for any keystrokes that exit the field:
If [Code(Get ( TriggerKeystroke )) = 13 or Code(Get ( TriggerKeystroke )) = 9 or Code(Get ( TriggerKeystroke )) = 10]
#put your script steps here to do stuff when the user exits the field
#keep the triggering keystroke from taking the user to the next field
Exit Script [Result: False]
This example is set up for a field where its behavior is enabled for keys 9: Tab, 10: Enter (keypad) or 13: Return (Qwerty) to take the user to the next field in the tab order.
I don't use OnExitObject for this because then using the mouse to exit the field will also trigger the script and this almost always causes problems for the user when the focus suddenly jumps to a field other than where they clicked.