IIF for any

  • Thread starter Thread starter BonnieW
  • Start date Start date
B

BonnieW

Hi,

I'm looking for a way to restate this: =IIf([Fall]="1","Yes","No")
so that if ANY listing for Fall is 1, then it will return a "Yes" value. Is
there a better way to do this? It's being used in a report based off a query.


(Ideally, I'd like to update the base table with this info to make it
easier/eliminate this function, but the person with the knowledge isn't
available, and it would be a LOT of work for her.)

Thanks in advance!
 
= CBOOL(DCount("*", "tableNameHere", "Fall=1))

should do. I assumed Fall has numerical values in it, not alphanumeric. If
it is really string (alphanumeric), then use:


= CBOOL(DCount("*", "tableNameHere", "Fall='1'))



Hoping it may help,
Vanderghast, Access MVP
 
It's a checkbox, Yes/No field. Running the report with that- either of them-
doesn't quite work; it comes up with a numerical value (0), and I need it to
read either Yes or No for the user. The 0, I'm assuming, is No- and I've
tested it with what should be a Yes. :( Thanks for the try, though.

Michel said:
= CBOOL(DCount("*", "tableNameHere", "Fall=1))

should do. I assumed Fall has numerical values in it, not alphanumeric. If
it is really string (alphanumeric), then use:

= CBOOL(DCount("*", "tableNameHere", "Fall='1'))

Hoping it may help,
Vanderghast, Access MVP
[quoted text clipped - 9 lines]
Thanks in advance!
 
You have to format the result. Note that I originally missed a closing ".
You can force it as value:


= Format( CBOOL(DCount("*", "tableNameHere", " Fall='1' ")) , "Yes/No" )


and you can probably do it too as format for the control (in design view),
leaving the data numerical Boolean (-1 or 0 )


Note that a check box does not display "yes" or "no", but a check (or not),
and that works with Boolean values, generally. Again, if you have a value,
in a field, that is 0 or -1, you can impose a format, on the field, to
change the DISPLAYED appearance to "no" (0) or to "yes" (-1), while
keeping the 'value' in a working bit-wise, state like.



Hoping it may help,
Vanderghast, Access MVP



BonnieW said:
It's a checkbox, Yes/No field. Running the report with that- either of
them-
doesn't quite work; it comes up with a numerical value (0), and I need it
to
read either Yes or No for the user. The 0, I'm assuming, is No- and I've
tested it with what should be a Yes. :( Thanks for the try, though.

Michel said:
= CBOOL(DCount("*", "tableNameHere", "Fall=1))

should do. I assumed Fall has numerical values in it, not alphanumeric. If
it is really string (alphanumeric), then use:

= CBOOL(DCount("*", "tableNameHere", "Fall='1'))

Hoping it may help,
Vanderghast, Access MVP
[quoted text clipped - 9 lines]
Thanks in advance!
 
Yes or True is stored as a -1 (minus one).
--
KARL DEWEY
Build a little - Test a little


BonnieW said:
It's a checkbox, Yes/No field. Running the report with that- either of them-
doesn't quite work; it comes up with a numerical value (0), and I need it to
read either Yes or No for the user. The 0, I'm assuming, is No- and I've
tested it with what should be a Yes. :( Thanks for the try, though.

Michel said:
= CBOOL(DCount("*", "tableNameHere", "Fall=1))

should do. I assumed Fall has numerical values in it, not alphanumeric. If
it is really string (alphanumeric), then use:

= CBOOL(DCount("*", "tableNameHere", "Fall='1'))

Hoping it may help,
Vanderghast, Access MVP
[quoted text clipped - 9 lines]
Thanks in advance!
 
Thanks! I had thought that Yes was stored as a 1, not -1; that may help
quite a bit as I tinker.

Right now I have this:
=Format(CBool(DCount("*","tablename"," Fall=-1")),"Yes/No")

And it works perfectly. Thank you very much!

Michel said:
You have to format the result. Note that I originally missed a closing ".
You can force it as value:

= Format( CBOOL(DCount("*", "tableNameHere", " Fall='1' ")) , "Yes/No" )

and you can probably do it too as format for the control (in design view),
leaving the data numerical Boolean (-1 or 0 )

Note that a check box does not display "yes" or "no", but a check (or not),
and that works with Boolean values, generally. Again, if you have a value,
in a field, that is 0 or -1, you can impose a format, on the field, to
change the DISPLAYED appearance to "no" (0) or to "yes" (-1), while
keeping the 'value' in a working bit-wise, state like.

Hoping it may help,
Vanderghast, Access MVP
It's a checkbox, Yes/No field. Running the report with that- either of
them-
[quoted text clipped - 18 lines]
 
Back
Top