Query IIF function

E

Evan

I have a Query field: TaxAmt:
Iff([Base]>1,[Base]+([TaxRate]*(([Forms]![frmCrit]![UserInc])-[Low])),[TaxRate]*[Forms]![frmCrit]![UserInc])

I get an error message: undefined function IIF in expression. Should the IIF
function be placed in the critieria row rather than the field row?

Evan
 
M

Marshall Barton

Evan said:
I have a Query field: TaxAmt:
Iff([Base]>1,[Base]+([TaxRate]*(([Forms]![frmCrit]![UserInc])-[Low])),[TaxRate]*[Forms]![frmCrit]![UserInc])

I get an error message: undefined function IIF in expression. Should the IIF
function be placed in the critieria row rather than the field row?


Check it again. The expression you posted uses IFF, not
IIF.
 
E

Evan

Thanks. I have another problem: The subform based on the query is generating
#NAME? error in the TaxAmt column. Here's the setup: A form with a textbox
control (user types in a number) as the source for both TaxAmt field and as a
parameter in 2 other fields in the query. The query SQL code:

SELECT C.CountryName, AllFdTxSch.TaxRate,
IIf([Base]>1,[Base]+([TaxRate]*([Forms]![frmCrit]![UserInc]-[Low])),[TaxRate]*[Forms]![frmCrit]![UserInc]) AS TaxAmt, AllFdTxSch.Base
FROM C INNER JOIN AllFdTxSch ON C.CountryID = AllFdTxSch.CountryID
WHERE (((AllFdTxSch.Low)<=[Forms]![frmCrit]![UserInc]) AND
((AllFdTxSch.High)>[Forms]![frmCrit]![UserInc]));

Any ideas on how to rectify this?

Thanks Evan
 
M

Marshall Barton

Evan said:
Thanks. I have another problem: The subform based on the query is generating
#NAME? error in the TaxAmt column. Here's the setup: A form with a textbox
control (user types in a number) as the source for both TaxAmt field and as a
parameter in 2 other fields in the query. The query SQL code:

SELECT C.CountryName, AllFdTxSch.TaxRate,
IIf([Base]>1,[Base]+([TaxRate]*([Forms]![frmCrit]![UserInc]-[Low])),
[TaxRate]*[Forms]![frmCrit]![UserInc]) AS TaxAmt, AllFdTxSch.Base
FROM C INNER JOIN AllFdTxSch
ON C.CountryID = AllFdTxSch.CountryID
WHERE (((AllFdTxSch.Low)<=[Forms]![frmCrit]![UserInc]) AND
((AllFdTxSch.High)>[Forms]![frmCrit]![UserInc]));

I don't see anything in the query that would cause it.
Double check the spelling of the TaxAmt field in the text
box's Control Source
 

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

Similar Threads


Top