Can anyone tell me why the following IIF statement wouldn't work?
IIF ([species] = "Beef", "True", "False")
No matter what the species, it says false.
Thank you, Rockpicker
Can anyone tell me why the following IIF statement wouldn't work?
IIF ([species] = "Beef", "True", "False")
No matter what the species, it says false.
Thank you, Rockpicker
I think my brackets are correct. It's a "short text" format in the table...would that cause problems? I saw something about LEFT....is that something I need to add to this formula somehow?
Where are you doing this calculation? In a Query, Report, etc?
Are you sure that there aren't any extra spaces before or after the value in the field?
Also make sure species isn't a lookup field that's actually storing a numeric value.
Hi JoeM I am doing this in a report. I displayed the Species above my calculation to see if there was some problem, and it shows the species as Beef but the calculation doesn't say True
And as for spaces, is there a way to include any spaces...is that what "*" does? I put in = "*Beef*" and it still said false.
Thanks for your help
Species is a ShortText field...I wondered if that was causing a problem. It isn't a lookup field...it's imported into the table from an excel sheet. The report that I am using it in is based on a Join query. When I look at the table it has Beef and the other species.
In what section of the Report are you doing this in?Hi JoeM I am doing this in a report.
It shouldn't matter.Species is a ShortText field.
Why not do the calculation in the Query instead of directly on the Report? Then you can simply drag that field from the Field List box to the Report.The report that I am using it in is based on a Join query.
I usually find that works better, and you will instantly be able to see if it is returning the correct values for all of your data.
Sorry for the brackets comment, but when I first read the post I did not see the brackets????
In the summary/Footer section of the report. I'm trying to fix a report quickly as they needed it this weekend. I need to sit down and really figure out how to do it correctly but wanted to give them something that works until then. I need to do a different calculation if the species is Beef than all the others. I don't know how to do it in the query quickly.
I went in and editted it soon after posting with the correct brackets.
I tried this and it still says False. Right above the IIf statement, I displayed the species to see if I was missing something and it displays Beef.
Can you attach the db here?
This is not an aggregate calc and really doesn't belong in Report footer. It calculates based on last record loaded. Try moving into Detail section.
However, the other textbox is apparently showing value from first record loaded.
I have tested with my report and observe these behaviors.
Editing report RecordSource query should be just as simple as calc in textbox.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.