View Single Post
  #4  
Old August 18th, 2008, 01:03 PM posted to microsoft.public.access.reports
Mike from Moriches
external usenet poster
 
Posts: 11
Default Expression in unbound control

Thanks Duane and Marshall - The Choose function works just fine, and I like
the thought of "Planning ahead using the Table approach.

"Marshall Barton" wrote in message
...
Mike from Moriches wrote:

I have a report listing records containing a [CommitteeStatus] field. The
field contains either a 1,2 or 3. I would like to display Pending,
Approved
or Denied in an unbound control named Status instead of the digits.
Nothing
prints in the control unless I put something in the datasource property,
but
that won't take the If statements in the code below.


You can set the text box's control source expression to:

=Choose(CommitteeStatus, "Pending", "Approved", "Denied")

However, it would be better to create a little table with a
status number field and another field for the corresponding
text. Then the report's record source query can join to
this table and include the text without using an expression.
The reason this approach is much better is that it's a lot
easier to modify the list of statuses without having to
change your program. E.g. Think about some manager
deciding that "Denied" is not adequate and tells you to
change it to "Filed for future consideration" and add two
new status values for "Stupid idea" and "Resubmit after
expanding idea".

This new table would also be used by a combo box in the data
entry form. so users can not make a mistake entering a
status.

--
Marsh
MVP [MS Access]