PDA

View Full Version : Help with query involving nulls



coopeed
09-21-2007, 06:38 AM
Hi All.
I am unable to retrieve records with a zero dollar amount or is null when the user selects '0' from the combobox on a form. I have the following in the criteria on my query:

IIf(([forms]![form1]![combo2]=0),([tblApprovalAmounts].[AMOUNT]) Is Null Or ([tblApprovalAmounts].[AMOUNT])=0,[forms]![form1]![combo2])

Any ideas on what may be wrong?

Thank you for your help.

Oorang
09-21-2007, 10:33 AM
I think it's a synax issue. Remember IIF is three parts: Logical Test, Value if True, Value if False. (Similar to a ternary operator.) If I take apart your statment it is:
Test: ([forms]![form1]![combo2]=0)
True: ([tblApprovalAmounts].[AMOUNT]) Is Null Or ([tblApprovalAmounts].[AMOUNT])=0
False: [forms]![form1]![combo2]


Which makes it look like you have part of your test in the true statement... Or was it your intention to perform a bitwise operation in your true statement?