View Full Version : nesting IiF


matt123
11-25-2001, 11:52 AM
Hi
I have particular problem that I cant seem to go any farther on. I am attempting to nest an Iif insied another Iif and I get mixed results.
In my industry, you are allowed 1 year from EntryDate before ExpirationDate. You may however, request (2)extensions of 1year each, which thereby changes the expiration date(according to how many extensions are done(if any).


This is the way I have written so far:


CalculateExpirationDate: IIf("2nd Extension Granted",[tblEntry]![EntryDate]+1095,
IIf("1st Extension Granted",[tblEntry]![EntryDate]+730,[tblEntry]![EntryDate]+365))

The problem is, I get wrong calculations on everything, except the entries with 2nd Extensions granted. In fact, it treats all entries as though a 2nd Extension were granted.
Hope I havent confused you, and would appreciate any help you could give.
Thx, Matt

Jack Cowley
11-25-2001, 02:40 PM
Assuming the 1st and 2nd extension granted fields are Yes/No field the try this:

CalculateExpirationDate: IIf([2nd Extension Granted] = -1,[tblEntry]![EntryDate]+1095,
IIf([1st Extension Granted] = -1,[tblEntry]![EntryDate]+730,[tblEntry]![EntryDate]+365))

Replace [2nd Extension Granted] and [1st Extension Granted] with the proper field names.