label based on another field

K

KateB

Hi,

I have a report that I would like to display a label box appropriate to what
is in another field. For example:
If text box z = A, label 1 is displayed
If text box z = B, label 2 is displayed
If text box z = C, label 3 is displayed

The label is laid out in a particular way which is why I can't do it in the
query the report is based on. I can't see any way of linking the 2 together.
Can anyone help?
 
D

Duane Hookom

Are all the label properties basically the same other than the caption
property? If so, I would change the label to a text box and use some method
of setting the value of the text box.

My preferred method would be to create a small lookup table with A, B, and C
in one field and the appropriate caption in the other field. Then add this
table to your report's record source and join the ABC fields of both tables
and add the caption field to your report's record source.
 
K

Klatuu

I would do it differently. Rather than use labels, use text boxes.
Use an IIf statement in each text box to display a value based on the value
of text box z. You would have to reference record source field that text box
z is bound to. For example purpose, I will call it FldZ
For the first one it would be:

=IIf([FldZ] = "a","I am Lable1","")

then
=IIf([FldZ] = "b","I am Lable2","")

and
=IIf([FldZ] = "c","I am Lable3","")
 
K

KateB

Thanks - went for this one as it looked the easy option and it works great!

Klatuu said:
I would do it differently. Rather than use labels, use text boxes.
Use an IIf statement in each text box to display a value based on the value
of text box z. You would have to reference record source field that text box
z is bound to. For example purpose, I will call it FldZ
For the first one it would be:

=IIf([FldZ] = "a","I am Lable1","")

then
=IIf([FldZ] = "b","I am Lable2","")

and
=IIf([FldZ] = "c","I am Lable3","")

--
Dave Hargis, Microsoft Access MVP


KateB said:
Hi,

I have a report that I would like to display a label box appropriate to what
is in another field. For example:
If text box z = A, label 1 is displayed
If text box z = B, label 2 is displayed
If text box z = C, label 3 is displayed

The label is laid out in a particular way which is why I can't do it in the
query the report is based on. I can't see any way of linking the 2 together.
Can anyone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top