IIf question

CharlieC

Registered User.
Local time
Today, 00:36
Joined
Aug 21, 2009
Messages
10
Hi

Am very new to access so please go easy on me, I am sure this is pretty easy to do but I am now completely confused!

I am basically trying to set up a box on my form where when you enter a value it tells you next to it whether the value falls between specified limits (PASS) or outside the limits (FAIL)

So have got as far as figuring out something like this is required:
=IIf([Pen25]<= 50 OR >= 70 "FAIL","PASS")

but in real life it doesn't work and even if it did I don't know where it goes!

Don't suppose anyone could give me some ideas or even pointers on where I could look for more info?

Thanks
Charlotte
 
Try

=IIf([Pen25]<= 50 OR [Pen25]>= 70 "FAIL","PASS")
 
Thanks so much for your quick reply, stupid question though - where do I put it?!
 
With the = sign in front, I assumed you had it as the control source of a textbox.
 
Ok that's good I did - by luck rather than judgement though!! Have tried your revised version (thanks again) but it is returning a syntax error?
 
Sorry, missed that in the original. Try

=IIf([Pen25]<= 50 OR [Pen25]>= 70, "FAIL","PASS")
 
That works perfectly thank you very much!

Just wondering if it is possible for it not to automatically display "pass" on a new record? I think I would be able to do it now but don't know what the expression is for no value entered (an empty box)?
 
=IIf(IsNull[Pen25])" ", ([Pen25]<=50 Or [Pen25]>=70,"FAIL","PASS") ?????

Am trying hard (and surprisingly enjoying myself!) but clearly haven't got a clue what I am doing!!!
 
Here are the components to an IIF statement:

IIF([ExpressionToCheck],"WhatHappensIfTrue","WhatHappensifFalse")

As for having a blank text box...

(Assuming that you are using a button to go to a new record)
Add some code to set the value of the text box to nothing..

me.TextBoxName = ""
 
=IIf(IsNull[Pen25])" ", ([Pen25]<=50 Or [Pen25]>=70,"FAIL","PASS") ?????

Am trying hard (and surprisingly enjoying myself!) but clearly haven't got a clue what I am doing!!!

Whether you choose to believe it or not, you have a good general idea, and need to be pushed a little in the right direction. Since you now have three cases, a compound IIF() statement will probably do what you want. Note the minor changes that I made.

=IIf(IsNull[Pen25]), " ", IIf([Pen25]<=50 Or [Pen25]>=70,"FAIL","PASS"))
 
Thanks for not just laughing me out of town, that makes complete sense. It is fab that you guys are willing to help complete beginners like me. Hopefully one day I will be able to give something back!
 
Sorry cross posted, can't believe I was actually pretty close! Thanks again!
 
Thanks for not just laughing me out of town, that makes complete sense (unlike the random stuff I was doing!) It is fab that you guys are willing to help complete beginners like me. Hopefully one day I will be able to give something back!

It was not too long ago that I was wearing your shoes. A few projects later, I was able to buy my new ones. If you are patient and willing, your turn will come.
 

Users who are viewing this thread

Back
Top Bottom