IIF function in a query

G

Guest

Hi,

I have a function in a query which i say if the number in the field is <1,
then it would print out field A. If not, then it would print out field B.
However, i keep getting #Error in the field, whenever i run the query. My
statement looks like this:

iif ( [table1.fieldA]< 1, [table1.fieldB], [table1.fieldA] )

Any suggestions??

Thanks,
Rob
 
G

Guest

Yeah, i actually discovered my problem: i needed to put " " around the 1
where i had iif([table1.fieldA] > 1,

thanks for your help!

Rob
 
J

John Spencer (MVP)

Is your IIF statement copied from the query? I would expect it to fail because
of the way you have your brackets around the entire table name plus field name.
You should have the brackets around each part.


iif ( [table1].[fieldA]< 1, [table1].[fieldB], [table1].[fieldA] )
 

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