Simplest way to enforce that rule is to create a validation rule on the
table. Access is than unable to save any record that does not meet the rule.
Steps:
1. Open your table in design view.
2. Open the Properties box (View menu).
3. Enter the expression below into the Validation Rule in the Properties
box:
([e-newsletter] = False) OR ([email address] Is Not Null)
Make sure that goes into the rule in the box, NOT the Validation Rule in the
lower pane of the table design window. (That one applies to one field, and
you need the one that applies to the table.)
If is also possible to use Form_BeforeUpdate event, but that's better only
when you want to give the user the choice to break the rule.
--
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.
John said:
I want to validate one field against another on a form. I have an email
address and a Y/N field asking if they want to receive a newsletter by
email. The validation is: If e-newsletter is "Y" then there must be an email
address provided. I tried this but it doesn't seem to like me testing for
Null in the email address field. I put this validation into the BeforeUpdate