"IF" Statement

XSara

New member
Local time
Today, 06:39
Joined
Apr 13, 2014
Messages
4
I have a problem writing a correct If Statement.
So the case goes like this:

I have a database of Contractors that my Company works with. So at the end of each job we evaluate them and give them marks.
If the Contractor gets >80 then we should continue working them him
If the Contractor gets between 70 and 80 then we should send him a Warning
If the Contractor gets <70 then we should stop working them him

This is how I tried writing it in the Form:
= IIf([Evaluation Mark] >80,"Continue Working with the Contractor",IIf([Evaluation Mark] >70 and <80, "Send Warning", "Stop working with the Contractor"))

But this is what I keep getting:
"The expression you entered contains invalid syntax"
"You may have entered a comma without a preceding value or identifier"
(screen shot attached)

So please help me correct it.

P.S.: - The two fields are already included in original Table.
- No query is available.
 

Attachments

  • Syntax Error.jpg
    Syntax Error.jpg
    101.8 KB · Views: 82
Try:
=IIf([Evaluation Mark]>80,"Continue Working with the Contractor",IIf([Evaluation Mark]>70,"Send Warning","Stop working with the Contractor"))
 
Dear Bob
Thanks for your prompt reply.
Actually the statement worked and no error message appeared, but the "Decision" field/box was not updated accordingly.

It seams I'm writing the statement in the wrong place. I put it in the "decision" text box/ in the "On Got Focus" in the "Event" Tab.
(A screenshot attached)

What I actually need is to update the "Evaluation Mark" text box, and the "Decision" text box to be updated automatically.

Thx again for your help.
 

Attachments

  • gotfocus.jpg
    gotfocus.jpg
    91.9 KB · Views: 98
Use the expression supplied as the Control Source property of the "Decision" text box. This will not save the text to the forms Record Source but as the expression is basically a calculation, it should not actually be saved to a table but recalculated whenever and wherever it is required using the same expression.
 

Users who are viewing this thread

Back
Top Bottom