M
Marshall Barton
rgrantz said:I have an unbound form in which users input the Start Date and End Date to
use for reports that open based on the button clicked. When the user enters
a date syntax wrong (ie. 1//2/03), it seems the place to capture the 2113
(invalid entry) error is in the form's OnError event, NOT the control's
BeforeUpdate event. I am able to trap and show my own msgbox, but cannot
for the life of me undo the text entered in the date field. None of the
following works after the dataerr = 2113 check:
cancel = true
me.undo
me.controlname.undo
me.controlname = ""
me.controlname.text = ""
me.controlname.value = ""
me.controlname = null
All the posts I've seen on undoing unbound control entry say to use
me.controlname.undo, but this does nothing. The Esc key works, and I've
seen that me.undo is supposed to duplicate the pressing of the Esc key, but
it isn't.
You can not change the value in the Form's Error event, so
all your Me.Controlname = . . . tries won't work.
I just checked it in AXP and Me.controlname.Undo worked for
me in the form's Error event. You didn't mention it, but I
don't think you'll get an error unless you set the control's
Format property to a date format.