Hi -
Nested Iif() statements can be a problem. One misplaced parenthesis and you're sunk. You might consider the Switch() function, e.g.
AgentNo: Switch([strAgentNo]="67322" and Right([strProductCode],2)="12", "29221", [strAgentNo]="29221" and Right([strProductCode],2)="24", "67322", True...