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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format field 2

Status
Not open for further replies.

mmaz

Programmer
Nov 22, 2000
347
Hi,

Is there anyway in Access Reports to change the value of a field if it's equal to something? For example, the value of a field will be 1, 2, 3 or 4.

If 1, I want to display "First"
2: "Second"
3: "Third"
4: "Fourth"

How do I do this, and where? Do I use VBA, or is it in the properties of the field? Please be very descriptive as I just started writing reports with Access yesterday. (lots of experience with Crystal Reports, though...)

Thanks,

Marie :)
 
Hi

Two possible ways:

In the query on which the report is based, have a calculated column eg X:=IIF(MyField=1,"One",IIF(MyField=2,"Two",....etc

Or in the report use

Use VBA

In the ONFormat event of the section containing the control (ie header, Detail, Footer etc), put

Select Case MyValue
Case 1
txtControl = "One"
...etc Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks so much for your help, Ken!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top