>Thanks for the advice. I've got the PreSaveHook working but I'm still having problems with the VALID.
>
>I put the following code in the VALID method and thought it would prevent
>the focus from changing to the next field/control until data was added to
>the "UnitNo" textbox. However, the textbox still looses focus. Any
>suggestions on how to keep the focus locked on the textbox until data is
>input.
Maybe the textbox isn't actually empty, but has one or more spaces in it at this point. Perhaps your check should be more precise in demanding that some characters are input. Initialise the value of the text box to, say "" or " " (for a 4 char field). Then you can test for the value <> SPACE(4).
>
>I also replaced the RETURN with a .setfocus command but got an error that
>this was not allowed in a VALID method.
As Naomi said, you should return 0 or .F., but have a care for when the frustrated user wishes to abandon the update and can't get out of this field.
>
>
>IF EMPTY(ALLTRIM(thisform.txtEmergency_UnitNo.Value))
Why not:
IF EMPTY( This.Value)
or:
If this.value = SPACE(4)
As it is the valid clause OF the field thisform.txtEmergency_UnitNo
> WAIT WINDOW "Unit Number is Required for ALL Emergency Orders!" TIMEOUT 2
> RETURN
>ENDIF
>
>
HTH
Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.