IIf inside of IIf

M

Matthew Loraditch

I have the following statement in a query and i've read elsewhere that i can
have an if inside of an if
Purchase Total: IIf([Create Subs].[Subtotal]="0",[PO Table].[Credit Total],
(IIf([PO Table].[Tax]=0,0,0.05)*[Create Subs].[Subtotal]+[Create
Subs].[Subtotal]+[PO Table].[Shipping Charge]))
The if not true part: IIf([PO Table].[Tax]=0,0,0.05)*[Create
Subs].[Subtotal]+[Create Subs].[Subtotal]+[PO Table].[Shipping Charge]
is what i had previously used for this field and that worked fine.
Now with my new version i get a data type mismatch error, which i am
presuming is somewhere in my condition and if true portion: IIf([Create
Subs].[Subtotal]="0",[PO Table].[Credit Total]
The field that is being checked for a zero value is formatted as currency
however i have tried changing what the 0 is formatted as ( 0.00, $0.00, etc)
and still get the same error
can someone please help with what may be wrong here, logically (in the
mental sense) it looks ok but access obviously doesn't agree.
Thanks
Matthew Loraditch
 
G

Guest

try removing the double quotes from around the 0 as in

IIf([Create Subs].[Subtotal]=0,[PO Table].[Credit .....
 
M

Matthew Loraditch

Thanks much to both of you, it was the quotes i had seen them in an example
somewhere and used them. Works perfectly now!
Matthew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top