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

IF statement to change Font Size 1

Status
Not open for further replies.

nixz

Technical User
May 16, 2009
3
GB
Hi All,

I have a field on my report that has text values. It is a textbox control. The field's control source is a query.

If the value of this textbox is "C" then I would like the font size of the textbox to increase. If the value is not C, then I would like the font size to stay constant.

Can anybody help me with this please?

Thank You
 
A little clarification for the retentive... a field doesn't have a control source. A text box or other control has a control source. A control source can't consist of a query. A control source can be lots of different expressions or a field name.

To your question, you might want to create two text boxes that are one on top of the other.
Control Source: =IIf([expression]="C","C",Null)
Make this one have a larger font size and allow it to shrink.

Control Source: =IIf([expression]="C",Null,[expression])
Make this one have a smaller font size and allow it to shrink.

Duane
Hook'D on Access
MS Access MVP
 
Dhookom, thanks for the reply.

I am a novice at Access and therefore do not understand some of the terms. Basically, using the report wizard, I added fields from a query. One of the fields is the textbox which has the values C and B. When the textbox shows the value C, I would like the font size to appear larger, but when it shows the value B, I would like the font size to stay constant.

Thank you for your suggestion, I will try it now :)

 
Thank You Dhookom, your suggestion has worked perfectly!
 
Dhookom, thanks for the reply.
Could I also have a simple way of how you do that technique as I dont understand some of the terms that you are using

Much Aprreciated!
 
To your question, you might want to create two text boxes that are one on top of the other.
[blue]You will want to display one or the other based on your condition[/blue]
Control Source: =IIf([expression]="C","C",Null)
[blue]The IIf() function evaluates the first argument (before the first comma) for true or false.
If the expression is true the second argument is returned. In this IIf() the True return "C"
[/blue]

Make this one have a larger font size and allow it to shrink.

Control Source: =IIf([expression]="C",Null,[expression])
[blue]If the expression is true the second argument is returned. In this IIf() the True return = Null and the False return is [expression][/blue]
Make this one have a smaller font size and allow it to shrink.
[blue]A shrunken text box with a value of Null will disappear.[/blue]


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top