Ahhhhhhh..... isn't just intriguing how one idea can interfere with another?
You are correct that this code will not let the user exit the control unless
the value is entered. That precludes the ability to click on a "close" or
"cancel" command button, as it appears that you've discovered.
Therefore, the use of the Exit event is one that I do very rarely, for just
that reason. (Frustrated users will resort to Crtl+Alt+Delete, which is
almost guaranteed to mess up your database worse than wrong data!)
Therefore, if you know that there is a valid data range for a control to get
upon entry, one uses the BeforeUpdate event of the control.
If you wish to validate that all bound controls have values when you require
such values, use the form's BeforeUpdate event to validate that each control
has a desired value.
If one wants to validate only upon "tabbing" out of a control, but not
validate when clicking on another control (including a command button), it's
possible to put very tiny, almost invisible textboxes on the form, with a
textbox in the "tab order" after each "big" control. In those small
textboxes' GotFocus event, test if the "preceding" control has a value, and
if not, display a message and set the focus back on that control. If the
preceding control has a value, then set focus on the next control in your
sequence. This is not easy to maintain if you find that you are redesigning
your form, as you not only set a tab order for the form but also must
duplicate the tab order in the code that runs in the GotFocus events for
those "tiny" textboxes.
--
Ken Snell
<MS ACCESS MVP>