By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 1,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

validation, before_update and after_update

P: n/a
I'd like to have validation of the inputted text, in a form textbox. I
want to give the user the option to try again, or to cancel out after
which the textbox is either cleared or restored. I just don't succeed.

In the before_update event, I can cancel out the change, after which the
input box keeps the focus. Fine. But I can't change the value for the
input box in case he wants to cancel out, it gives an error.

I can restore or clear the input box in the after_update event, but I
can't keep the focus on the textbox. Event setfocus() doesn't help.

What must I do? I threw something together that can set Cancel to true
in before_update, but I have to check again in after_update to allow the
user to wipe the field after giving up. I effectively must check the
validation twice, which is annoying if the validation routine pops up a
msgbox informing the user of the error; or, must I set a global variable
in before_update to check in after_update? Ugly!

--
Bart.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Bart Lateur wrote:
I'd like to have validation of the inputted text, in a form textbox. I
want to give the user the option to try again, or to cancel out after
which the textbox is either cleared or restored. I just don't succeed.

In the before_update event, I can cancel out the change, after which
the input box keeps the focus. Fine. But I can't change the value for
the input box in case he wants to cancel out, it gives an error.

I can restore or clear the input box in the after_update event, but I
can't keep the focus on the textbox. Event setfocus() doesn't help.

What must I do? I threw something together that can set Cancel to true
in before_update, but I have to check again in after_update to allow
the user to wipe the field after giving up. I effectively must check
the validation twice, which is annoying if the validation routine
pops up a msgbox informing the user of the error; or, must I set a
global variable in before_update to check in after_update? Ugly!


Either leave the entry for the user to clear with the <Escape> key or use
....

Me.ControlName.Undo

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

P: n/a
Rick Brandt wrote:
Me.ControlName.Undo


Perfect. Works fine in before_update, and allows the focus to move on to
the next textbox.

--
Bart.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.