not allowing tab or enter to move away from a control box until change is made

J

jtd135

Is there a way (WITHOUT ERROR MESSAGES), to NOT allow a user to move from one control box to another (by means of pressing tab or enter), until the value (a number) in that control box has changed?

Any help anyone can give on this matter would be much appreciated

Thanks!
 
D

Dirk Goldgar

jtd135 said:
Is there a way (WITHOUT ERROR MESSAGES), to NOT allow a user to move
from one control box to another (by means of pressing tab or enter),
until the value (a number) in that control box has changed?

By control box, do you mean text box? I'm sure it can be done, up to a
point, but I should warn you that if I had an application that did that
to me, I'd probably trash it.

For a bound control, you could probably do it with code in the control's
Exit event that compares the control's Value property with it's OldValue
property. If they are equal or both Null, then cancel the event.

That won't work for unbound controls, though. If you need to do that
with an unbound control, you probably have to save the value of the
control in a module-level variable on entry to the control, and then
compare to that variable on exit.

You still can't keep the user from closing the form to get out.

HOWEVER, it's much better to let users move around at will in your
forms, and just check for valid/complete data entry when the record is
about to be saved, in the form's BeforeUpdate event. It doesn't usually
matter what order the user follows in filling out controls, so long as
the record that is actually saved in the table is consistent and
complete.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top