Displaying text on a report based on the value of a numeric field

M

Madhav

Hi,
I have a numeric field in my database, lets say
field "flag". Now if the value of the record is 1, i want
a * to be displayed on the report. I have tried this code,
but it did not work :

IIF([flag]=1,"*","#"), but this did not work. Please help
me with this.
 
M

Marshall Barton

Madhav said:
I have a numeric field in my database, lets say
field "flag". Now if the value of the record is 1, i want
a * to be displayed on the report. I have tried this code,
but it did not work :

IIF([flag]=1,"*","#"), but this did not work. Please help
me with this.

What do you mean by "this did not work"?

Where is that "code"?

If you placed that expression in the control source property
of a text box control, then you must preceed it with an =
sign:
=IIf([flag] = 1, "*", "#")

If you're using the expression in VBA, you should include
more of the code so we can see what else may be going on
around it.
 
M

Madhav

Hi,
Yes, I have placed the code in the control source
property only, and I have placed the exact code mentioned
by you. But on the report it displays #Error. Please
advise me as what should be done.
 
D

Duane Hookom

Make sure the name of the control is not also the name of a field.

--
Duane Hookom
MS Access MVP


Madhav said:
Hi,
Yes, I have placed the code in the control source
property only, and I have placed the exact code mentioned
by you. But on the report it displays #Error. Please
advise me as what should be done.
What do you mean by "this did not work"?

Where is that "code"?

If you placed that expression in the control source property
of a text box control, then you must preceed it with an =
sign:
=IIf([flag] = 1, "*", "#")

If you're using the expression in VBA, you should include
more of the code so we can see what else may be going on
around it.
 
M

Madhav

Thanks a lot. The mistake i was making was pointed out by
Duane. U r too good. Thanks again!!!
-----Original Message-----
Make sure the name of the control is not also the name of a field.

--
Duane Hookom
MS Access MVP


Hi,
Yes, I have placed the code in the control source
property only, and I have placed the exact code mentioned
by you. But on the report it displays #Error. Please
advise me as what should be done.
What do you mean by "this did not work"?

Where is that "code"?

If you placed that expression in the control source property
of a text box control, then you must preceed it with an =
sign:
=IIf([flag] = 1, "*", "#")

If you're using the expression in VBA, you should include
more of the code so we can see what else may be going on
around it.


.
 

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