B
BruceM
I have a form with a subform. I am using validation in the form's Before
Update event to assure required fields are filled in. However, when I click
into the subform the record is saved, and the Before Update code runs before
I'm ready for it. Is there a way, short of hiding the subform, that I can
allow the user to click into the subform without producing a message that a
required field is missing a value? The logical flow of things is to select
the subform values fairly early in the process of entering a record, rather
than after everything else is complete, which is why hiding the subform
would be awkward.
This outlines the problem. The rest of this posting describes how I have
attempted to solve it.
I have an awkward workaround that involves a boolean being set to True or
False under different circumstances. If it is True, the rest of the Before
Update code is skipped. The form is divided into sections; each section
either needs to be complete or not started. If it is not started, the
boolean is set to True, and the rest of Before Update is skipped.
I can set the boolean to True if the record is new (which is the only time
when the subform comes into play). With it set to True Before Update will
be skipped. The user can click into the subform without invoking the Before
Update code. When the user clicks into one of the other text boxes (Text1,
Text2, and Text3) in the first section, the boolean is set to False. The
next time the user attempts to save the record, the Before Update code will
run because the boolean is False. The trouble is that if the user clicks
into Text1 (thus setting the boolean to False), then clicks into the
subform, Before Update will produce an error message that Text2 and Text3
need to be filled in.
Training should be able to solve this, but unfortunately I cannot count on
it, for reasons that would make me sound bitter were I to describe them.
Update event to assure required fields are filled in. However, when I click
into the subform the record is saved, and the Before Update code runs before
I'm ready for it. Is there a way, short of hiding the subform, that I can
allow the user to click into the subform without producing a message that a
required field is missing a value? The logical flow of things is to select
the subform values fairly early in the process of entering a record, rather
than after everything else is complete, which is why hiding the subform
would be awkward.
This outlines the problem. The rest of this posting describes how I have
attempted to solve it.
I have an awkward workaround that involves a boolean being set to True or
False under different circumstances. If it is True, the rest of the Before
Update code is skipped. The form is divided into sections; each section
either needs to be complete or not started. If it is not started, the
boolean is set to True, and the rest of Before Update is skipped.
I can set the boolean to True if the record is new (which is the only time
when the subform comes into play). With it set to True Before Update will
be skipped. The user can click into the subform without invoking the Before
Update code. When the user clicks into one of the other text boxes (Text1,
Text2, and Text3) in the first section, the boolean is set to False. The
next time the user attempts to save the record, the Before Update code will
run because the boolean is False. The trouble is that if the user clicks
into Text1 (thus setting the boolean to False), then clicks into the
subform, Before Update will produce an error message that Text2 and Text3
need to be filled in.
Training should be able to solve this, but unfortunately I cannot count on
it, for reasons that would make me sound bitter were I to describe them.