Correct IIF statement needed please (1 Viewer)

Zenobia

Registered User.
Local time
Today, 12:46
Joined
Jan 28, 2011
Messages
35
Hello,

What is the correct way to state an IIF statement for this.. (in a query)

I have a field called "DueDate" (i.e. the duedate return of rental)
And i want to say if todays (now()) is greater than due date then ... Yes

I cant seem to figure it out, any help would be more than great at always
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:46
Joined
Jan 23, 2006
Messages
15,408
IIF (DueDate > Date,"OverDue","OK")
 

Zenobia

Registered User.
Local time
Today, 12:46
Joined
Jan 28, 2011
Messages
35
Thank you very much.. May I also be so cheeky as to ask help for another one?

What I am trying to do is calculate a fine based on my column "AOverDue" and [LengthDaysOverdue]
If the text in the box = "Overdue" then calculate the [LengthDaysOverDue] by my fine amount (i.e. 0.75)
However, i don't want it to calculate if it doesn't say "Overdue" (in my case "Ok")

What i've come up with so far is this... However i've done something wrong.

FineOnAccount: IIf([AOverDue]=True,[LengthDaysOverDue]*0.75,"No")

Much thanks in advance
 
Last edited:

boblarson

Smeghead
Local time
Today, 04:46
Joined
Jan 12, 2001
Messages
32,059
Best to use the same datatypes. So,

FineOnAccount: IIf([AOverDue]=True,[LengthDaysOverDue]*0.75,"No")


would become

FineOnAccount: IIf([AOverDue]=True,[LengthDaysOverDue]*0.75, 0)
 

Zenobia

Registered User.
Local time
Today, 12:46
Joined
Jan 28, 2011
Messages
35
Hello Bob,

That didn't work, mainly down to my lack of explanation, of which i apologise
This is along the lines of what i want to do:
Test: IIf([AOverDue]="OverDue",[LengthDaysOverDue]*0.75,[LengthDaysOverDue]=0)
However both [AOverDue] and [LengthDaysOverDue] is already a calculated field in this query.
My poor attempt (above) at trying myself to do it works out the calculation fine, however i dont wish to do a calculation if the value in the [AOverDue] field is "Ok"
 

Users who are viewing this thread

Top Bottom