Subform Required Fields

H

hotplate

I have a continuous subform with 3 combo boxes. The first one decides
the drop down list for the second, and the second one decides the list
for the third.

I want the 2nd and 3rd mandatory if the first box has a value selected.
I went to the table and made them required values. I found out that
if I do [combo2] = null on change of combo 1, I get an error saying
that I cant have a null value on combo 2 (end,debug). How can I make
these 2 fields mandatory and reset Combo 2 and 3 to null if Combo 1
changes (and the Combo 3 to null if Combo 2 changes)?

James
 
A

Allen Browne

Instead of setting the Required property of each field, set a Validation
Rule on the table.

1. Open the table in design view.

2. Open the Properties box (View menu.)

3. Beside the Validation Rule in the Properties box, enter:
([Combo1] Is Null) OR (([Combo2] Is Not Null) AND ([Combo3 Is Not Null))

The rule can be satisifed 2 ways:
a) If Combo1 is null, it's happy.
b) Otherwise, the only way it can be happy is if both the other combos have
values.

Note that since you are comparing fields, you must use the Valdiation Rule
for the table (in the Properties box), not the rule for a field (in the
lower pane of table design.)
 

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