On Wed, 18 Feb 2004 20:41:17 +0100, Georges Heinesch <vo**@void.com> wrote:
Hi.
My form contains a control (cboFooBar), which has an underlying field
with the "Required" property set to "Yes". Now, while filling out all
the controls of the form, I have to fill out this particular (required)
control as well.
However further down the form, there is another control, which has to
(under certain conditions) to delete again the content of the (required)
control just filled out before (cboFooBar). This is done by code.
However here comes the problem ... I cannot use "Me!cboFooBar.Value =
Null" since the "Required" property is set to "Yes". Access gives the
corresponding error message (logical!).
Now comes the question ... how can I delete a field, which has the
"Required" property set to "Yes".
TIA
I've been following this thread with interest because I recently had a similar
situation. I have basically a category/subcategory relationship on a form.
The category is not bound because it is simply used to filter the subcategory,
but if a subcategory is already chosen, and the user changes the category, I
want to null out the subcategory because it already appears to be null since
there's no longer a match in the subcategory combo's rowsource, and we don't
want to let the record get saved with the old subcategory ID value after a new
category has been chosen.
Basically, I found 3 possible solutions.
1. Make the control unbound. Set the control's value by copying from an
invisible bound control in the Form_Current handler, and don't update the
bound control from the unbound control until the Form_BeforeUpdate handler.
Of course, that's still a problem if there's some other save error, and the
user remains in edit mode.
2. Only display categories that have one or more subcategories, and
automatically pick the first subcategory when the category is chosen. This
might be slightly dangerous in terms of not forcing the user to explicitly
choose a subcategory, but it's not terrible. Also, some categories might have
only one category, and in this case, it's a nice, time-saving feature.
3. Cache all the control values, undo the record, and write back all the
values except the one that should now be null bending entry by the user. This
only helps on Add, not edit, and it's also in the "you must be joking"
category in terms of potential side effects, so that's a big no.
I think number 2 works out the best for my situation. Does this help in
yours?