You would normally do these sort of checks in the itemchanged event or call the logic from the itemchanged event. And remember the latest value is in the "data" string argument to the itemchanged event,
You can additionally consider calling accepttext() in the losefocus event, which in turn will trigger the itemchanged event if the data value has changed.