To me, the True/False portions are wrong. This [Job_Reference].[Floats_Qty]) likely has a value (or at least it depends on one). Say it is 5. Then 5 is >=0 so it will return True, not 5 and not 0 (except that False is also 0 and True is anything else). In other words it looks to me like you expect numeric values based on those 2nd and 3rd tests but you will only get T or F or their numeric representations. You probably need nested IIF's. Not possible for me to be specific based on your posts but along the lines of
IIF(TEST2,True part,IIF(TEST1,True part,False part),False part)
Could also drop the last false part if need be, I suppose. Key thing would be that the T F tests are not tests themselves unless you wrap each of those tests in IIF.
I think you're right! The reason my syntax for the checkboxes works is because the return of True or False just happens to match the value of the checkbox
If we take the following example SQL:
Code:
SELECT Job_Reference.Floats_Qty
FROM Job_Reference
WHERE (((Job_Reference.Floats_Qty)=IIf(IsNull([Forms]![Job_Reference_Form]![Floats_Qty]),(Job_Reference.Floats_Qty)>=0,(Job_Reference.Floats_Qty)>=[Forms]![Job_Reference_Form]![Floats_Qty])));
Lets say my form input is null. Upon execution, my WHERE clause becomes:
Code:
WHERE (((Job_Reference.Floats_Qty)=(Job_Reference.Floats_Qty)>=0)));
Which describes my issue! floats_quantity=true will return nothing, thank you
Now, however, I have a new issue. How do I return all values in SQL on an int?
My new WHERE clause of:
Code:
IIf((IsNull([Forms]![Job_Reference_Form]![Floats_Qty])),([Job_Reference].[Floats_Qty]),Null)
works for the most part, but does not return null values (when the IIF is true. I am ignoring the false return for now) and putting an "or is null" into my true return breaks it:
Code:
WHERE (((Job_Reference.Floats_Qty)=IIf((IsNull([Forms]![Job_Reference_Form]![Floats_Qty])),(Job_Reference.Floats_Qty)=([Job_Reference].[Floats_Qty]) Or ([Job_Reference].[Floats_Qty]) Is Null,Null)));
upon execution, I think it should turn into the following valid (tested) statement:
Code:
WHERE (((Job_Reference.Floats_Qty)=([Job_Reference].[Floats_Qty]) Or (Job_Reference.Floats_Qty) Is Null));
however it does not return any values. Thoughts?
sorry this is now pretty convoluted and confusing. I am currently playing around with the NZ() function and some other solutions. You have answered my question well enough