Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expressions in report fields

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to add some simple conditionals to report fields. The task at hand is to make a field of check marks to denote different dates so I want to have the leftmost field say &quot;iff(date < 2, &quot;X&quot;, &quot;&quot;)&quot; and subsequent fields increase 2 to 3 etc. I can't figure out the right expression syntax. I'd like to see an example of an expression that tests a value and then outputs text based on the answer. This seems like it should be simple, but I'm stumped!
Thanks,
-cliff
 
Hey Cliff!
Passing thought: a check box only accepts booleans (bit), so you may have to change the &quot;x&quot; in yout IIf function to &quot;true&quot; , &quot;yes&quot;, or -1 (not sure which).
Good luck!
-Geno
 
Thanks for suggestion. The crux of my question isn't over the syntax of IIf(), but how to get expressions to work within report fields (like combox boxes). I'm getting #error but don't know why. What is the syntax for field references? Is is
![field] or something else? Should I start with a leading '='?
Thanks,
-cliff
 
Hey Cliffman
I would need to know about the combo boxes in question, and if they are bound or unbound; and if bound, to what recordsource ( table or query). Also you say that this is a report, and not a form. Which section (header, detail, etc.) is the &quot;bad&quot; combo box in? Do you have the option of using any data access method to create a recordset on it?
There are many ways to resolve the prob; sounds like you want to set stuff in the property page for the control/report? In that case, an &quot;=&quot; is definitely required.
Won't be here much longer, but I'll set the reply to e-mail my web address...
-Geno
 
Actually, I'll describe the simplest case. I have a 'Release' field in a table that describes when software will be available. I want to report this graphically like this:
January February March
feature1 X
feature2 X
feature3 X
My plan to do this is to have a text box in each month column with a control source like
=IIf(Release = 1, &quot;X&quot;, &quot;&quot;)
and change the test for each column as appropriate.
So to answer your questions, I'm binding to a table in the detail section of the report.

Thanks very much for your help.
-cliff

 
I figured it out. I'm mixing data types - checking numbers and returning strings, that was my error. Now I'll just have to figure out how to either control a boolean control like a checkbox, or better yet output a little gif image.
-cliff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top