I have a field with value -1 ,o or null. I need to show those records which has value -1 as Yes, the following codes always gives me an error on the report:
=IIf([Graduated]="-1","Yes","")
Could you please give me some advice!
Thanks in advance!
The record source of the report comes from a table directly.
Graduated is one of the fields from the table.
I copied the following codes in the report module, but it wasn't called from control source of the graduated field(=ConvertBool([Graduated]))
Any more advice! Thanks!
It sounds as if this calls for a Boolean vs. text field.
The test for Graduated is either true (-1) or false (0).
There's no place for Null. Displaying a checkbox bound
to a boolean field, the value is either -1 (Checkbox
checked) or 0 (Checkbox not checked).
Consider adding a new boolean field and populate it using
cmmrfrds previous post. Once that is successful, delete
field Graduated from your table and rename the boolean
field Graduated.
Now you can use: Iif([Graduated], "Yes", "No") which is
the short version of Iif([Graduated] = True, "Yes", "No")
What happens when you set the control's controlsource to Graduated and open the report? Are you seeing values or #error? The suggested procedures should work fine if they are getting the expected values.
Just a thought...Are you trying to put this IIf expression in a text box that is already bound to a field from the table? If so, make a new unbound text box and put the IIf expression in it.
Sorry to reply to you all. I just came back from the vocation.
I found a solution by using a query as report's controlsource instead of using a table directly, in the query's criteria, I used the iif() statement, and everything is working the way I expected.
Thank you all for your help. I really appreciate it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.