Representing Alphabet instead of Number in MS Access Report Column

  • Thread starter Thread starter FA
  • Start date Start date
F

FA

Hi Freinds,
I have an issue. In my MS Access Report there is a column which shows
numbers only. But i do not want to show numbers instead i want to show
Alphabet. Here is the specification:

Text Box Name: Result

Numbers between 1 - 12 --> I want to show "L" in the text box
Numbers between 13 - 24 --> I want to show "M" in the text box
Numbers 25 and above---> i want to show "H" in the text box

Can somebody help me out please. I would really really appreciated it.

Thanks
Moe
 
Set the Control Source of the report to an equation:

=IIf([FieldName] >= 1 And [FieldName] <= 12, "L", IIf([FieldName] >=13 And
[FieldName] <= 24, "M", IIf([FieldName] > 25, "H", "Error")))

This is long enough that it will wrap in the newsreader. Place it all on one
line. Also, you may need to adjust how you handle the result if none of the
criteria are met. I have it returning Error, but you may just want to leave
it blank.
 
The control source of the report is a query that has many other fields
too. i tried to set the control source of the text box Result and its
not working.

Please help me out

Thanks
 
FA,I think Wayne may have meant to say "control" instead of "report" as to
where to place his code. (aplogies to Wayne if I misunderstood)
It needs to go into the ControlSource of an unbound text control on the
report, or... as a calculated field in the query behind the report.

Text Control on Report...
Place an unbound text control in the Detail section along side the Result
field with a ControlSource of...
(Wayne's solution)
=IIf([FieldName] >= 1 And [FieldName] <= 12, "L", IIf([FieldName] >=13
And
[FieldName] <= 24, "M", IIf([FieldName] > 25, "H", "Error")))
OR
(Mine)
= IIF(Result < 13,"L", IIF(Result > 12 and Result < 25,"M","H"))

Either should work OK...
 
Thanks Al,

Yes, a report doesn't have a "Control Source", it has a "Record Source". A
control has a "Control Source". I should have said "control" not "report".

--
Wayne Morgan
MS Access MVP


Al Camp said:
FA,I think Wayne may have meant to say "control" instead of "report" as to
where to place his code. (aplogies to Wayne if I misunderstood)
It needs to go into the ControlSource of an unbound text control on the
report, or... as a calculated field in the query behind the report.

Text Control on Report...
Place an unbound text control in the Detail section along side the
Result field with a ControlSource of...
(Wayne's solution)
=IIf([FieldName] >= 1 And [FieldName] <= 12, "L", IIf([FieldName] >=13
And
[FieldName] <= 24, "M", IIf([FieldName] > 25, "H", "Error")))
OR
(Mine)
= IIF(Result < 13,"L", IIF(Result > 12 and Result < 25,"M","H"))

Either should work OK...
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

FA said:
The control source of the report is a query that has many other fields
too. i tried to set the control source of the text box Result and its
not working.

Please help me out

Thanks
 
Back
Top