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

How do I add a Record Validation Rule using IIF Statements?

P: 1
Hi

I have a table tracking when members attend meetings.

Field 1 (Attended Meeting) = Yes/No type data type
Field 2 (Did the Member do a Presentation?) = Yes/No data type
Field 3 (Topic of Presentation) = Text data type

So essentially if a member attends a meeting; they indicate whether they did a presentation at the meeting or not. If they did do a presentation, they specify the topic of the presentation.

So I thought I'd add record validation rules to prevent:
a) someone from saying no attendance at a meeting but then putting in that they did a presentation

b) putting a presentation topic in when they answered NO to whether they did a presentation or not

So I need record validation rules here and I thought I'd use IIF statements here since these are all conditional expressions.

Is this is the best way and if so; what's the IIF statement to use?
May 6 '10 #1
Share this Question
Share on Google+
1 Reply


Jim Doherty
Expert 100+
P: 897
@zaimin
Considering in reality that all of your data should be entered using forms then If I were you I would create a query based on your table, create your form based on that query and then do all of your validation in your form controls and code behind the form.

You will get more control over your environment this way. You can do it in your table if you wish, it is up to you, but doing it in your form code allows for all sorts of logic to be applied not just expressions for example.

Expand|Select|Wrap|Line Numbers
  1. IF Me!Field2="No" then
  2.  
  3.         IF not isnull(Me!Field3) then
  4.            Me!Field3=Null
  5.         End If
  6.  
  7.    Me!Field3.enabled=false
  8.  
  9. End If


if you have total control over your design environment ie the physical data that gets entered into your tables then this is the my preferred method
May 6 '10 #2

Post your reply

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