By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

If field a = 1 , Field b must equal 1 or 3

P: 1
Hi,
I am quite new to Access and have just got comfortable with the basics of making forms, queries and reports.
I have a form with two fields in Purpose and Category.
The user puts in numbers into each field.
I would like to put in some code so that if purpose = 1 then category must = 1, or 3. If so, that's fine, if purpose does = 1 but category does not = 1 or 3 I would like a message box to say error.
If purpose = any other number than 1 I want nothing to happen?
does this make sense?
Any help would be great!
thanks
Sue
Jan 16 '07 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,494
Try putting this as the AfterUpdate event procedure for the Purpose control.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Purpose_AfterUpdate()
  2.     Me!Category.ValidationRule = IIf(Me!Purpose = 1, "=1 Or 3", "")
  3. End Sub
Jan 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.