1. Open your table in design view.
2. Click the Properties box View menu).
3. Set the Validation Rule in the Properties box to:
(Abs([Text1] Is Not Null)+Abs([Text2] Is Not Null)+Abs([Text3] Is Not
Null))=1
4. Repace "Text1", "Text2", and "Text3" with the name of your 3 fields.
Notes:
Make sure this goes into the Validation Rule for the table (in the
properties box), not that of a field (in the lower pane of table design).
It works like this:
If Text1 has a value, the phrase:
[Text1] Is Not Null
returns True. To Access, that's -1.
The Abs() function converts that to a number without the negative.
If it's not the case (i.e. if the field IS null), the value is zero.
Summing the 3 values gives you a count of the fields that have a value.
The rule is only satisfied if the count is exactly 1 (not 0 or 2 or 3).
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Dalan" <ot***@safe-mail.net> wrote in message
news:50**************************@posting.google.c om...
I apparently need a bit of assistance regarding the structure of some
validation code on the BeforeUpdate or AfterUpdate event on a form for
several fields that need to controlled. I did search the archives, but
found nothing precise enough to address my specific needs.
1. There are three text box fields on the form and one of the three
need to have a text value provided. I simply need to ensure that one
field has data, not two, not three and that a choice has to be made so
any of the three cannot be null before leaving record.
2. The other validation is similar. There is a check box on the form
and if checked by a user, then two other fields (one date, one
currency) on the same form required data to be entered before leaving
the record.
Thanks for anyone's assistance. Dalan