iff formula with two text conditions (1 Viewer)

nicko14

New member
Local time
Yesterday, 23:28
Joined
Feb 8, 2012
Messages
7
Hello,

First time poster, I searched the forums and tried to apply my situation / formula to others who had similar questions, but I get the #error output with no messages from access telling me what I did to cause this.

What I'm trying to do is create a formula that checks if two conditions are met, then applies an output. So I have a starting location [StartLocation] and [Stop2]...Both can be a small variety of locations.

Currently I have as follows:

Leg1: iif([StartLocation]="Location A" AND [Stop2]="Location B",500,0)

The formula would run longer in the end, going up to 10 stops, nesting the ifs and checking multiple locations for each stop.

Both my conditions are Text, and I want a number output depending on the location. Is it a simple error I'm looking past and missing? Or is what I'm trying not possible, I feel like it should be relatively easy. Access give me no trouble for save and running, but it outputs #error.

Please help if you can!

Much appreciated in advance,

Nick
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 04:28
Joined
Jul 9, 2003
Messages
16,271
Try ... iif(1 = 1,500,0)

what happens?
 

nicko14

New member
Local time
Yesterday, 23:28
Joined
Feb 8, 2012
Messages
7
Okay amazing thanks, I see how it works now! Thanks a lot.

IIF([StartLocation]=1 and [Stop2]=2,250,IIF([StartLocation]=1 and [Stop2]=3,500,0))

The above does exactly as I was looking for, so I should be good to go on and finish my formula now thanks a bunch again. I will post again if I hit any more walls, but I think I'm in the clear now! I will just have to print out a legend to make my coding go faster:D

Best Regards,

Nick
 

Users who are viewing this thread

Top Bottom