MS Access Format for a query

Closed
PM - Sep 12, 2011 at 07:02 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Sep 13, 2011 at 10:45 AM
Hello,

Thanks in advance for helping!!

I need to know how to add a format to a IIF query:

I know how to do it for a simply IIF: Expr:Format(IIF([Query]=0,"x","0.00")

But how do i add a format to a query that has about 5 IIF statements in it. I cant get it format each if statement.

Code: IIf([type]="A"," ",
IIf([type]="B",([correct rate]-[Overall])/100,
IIf([TYPE]="C",([correct rate]-[Income])/100,
IIf([TYPE]="D",([correct rate]-[Income])/100,([correct rate]-[Current Rate])/100))))

I need to know how i can make it so that the above is in the same format for each iif statement.

Thanks

PM


MS Access 2003
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Sep 13, 2011 at 10:45 AM
Not sure exactly what you seeking. It seems to me that all you want to do is format the expression
I would do like this

IIf([type]="A"," ",
format(([correct rate]- IIf([type]="B",[Overall], IIf([TYPE]="C",[Income],IIf([TYPE]="D",[Income],[Current Rate]))))/100,"0.00"))

One difference between yours and mine is that I am not doing subrtaction in each IIF. I Only get the relevant field ( but you can also do it your way too)
0