Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on iif Statement

Status
Not open for further replies.

kayek

Programmer
Jun 19, 2003
95
US
I am trying to change an Excel If statement to an Access iif statement.

=IF((AND(E2="",G2="")),Now()-D2,IF((+G2-$D2)>=0,(+G2-D2),(+E2-D2)))

I don't know what to do with the AND.

Kaye
 
Code:
IIF(E2="" AND G2="",Now()-D2, IIF(+G2-$D2>=0,+G2-D2,+E2-D2))
But you will need to change the Excel cell references to Access field names.
 
Kaye
In an conditional If (IIf) statement, the first part that follows the criteria is the True, the second part is the False.

In other words, IIf(Sky = Blue,"sunny","raining")

Following that logic, is what you want to evaluate
if both E2 and G2 = "" then TRUE PART, otherwise the FALSE part of the equation which is also conditional.?

If so it would go something like
IIf(E2="" And G2="",Now()-D2,IIf(G2-$D2)>=0,G2-D2,E2-D2)))

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top