[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Whats New!
Need a database?
Tips via email
Learn VBA
Questions Answered
Access Tips Index
What is MS Access

Formatting Textbox

 

 

Question

Formatting Textbox. I have a form with a subform attached. Subform is called Products Subform and the main form is called Products. On the subform I have a textbox which does a calculation i.e.

=Sum(nz([UnitsReceived])-nz([UnitsShrinkage])-nz([UnitsSold])) it then moves this calculation up to the main form to a box called UnitsInStock =[ProductsSubform].Form!UnitsInStock Now what I would like is the following,when the units in stock figure gets to Zero (0) or less, I would like it turn red and bold and also write "NONE" in the same box. Is this possible?

Answer

To turn it red or bold, use conditional formatting - found on your tool bar:

Click on the text box in question then, click on Format > Conditional Formatting.

Then, select the following options:

Field Value > Is Equal To > 0

Then, change the formatting to suit.

 

For writing the word ‘None’, if there is no stock available, try the following:

In the text box write the following:

=IIF([ProductsSubform].Form!UnitsInStock =0,"None",[ProductsSubform].Form!UnitsInStock)

The IIf statement displays the first option "None" of the statement is true; otherwise it displays the second option.

Note:  You would then have to change the conditional formatting to match, i.e. instead of:

Field Value : Is Equal To  : 0

It would be:

Field Value : Is Equal To : “None”

Formatting text box depending on the number value

Forms > Continuous Forms

Question

I have a form with a subform attached. Subform is called Products Subform and the main form is called Products. On the subform I have a textbox which does a calculation i.e.

=Sum(nz([UnitsReceived])-nz([UnitsShrinkage])-nz([UnitsSold])) it then moves this calculation up to the main form to a box called UnitsInStock =[ProductsSubform].Form!UnitsInStock Now what I would like is the following,when the units in stock figure gets to Zero (0) or less, I would like it turn red and bold and also write "NONE" in the same box. Is this possible?

Answer

To turn it red or bold, use conditional formatting - found on your tool bar:

Click on the text box in question then, click on Format > Conditional Formatting.

Then, select the following options:

Field Value > Is Equal To > 0

Then, change the formatting to suit.

For writing the word ‘None’, if there is no stock available, try the following:

In the text box write the following:

=IIF([ProductsSubform].Form!UnitsInStock =0,"None",[ProductsSubform].Form!UnitsInStock)

The IIf statement displays the first option "None" of the statement is true; otherwise it displays the second option.

Note:  You would then have to change the conditional formatting to match, i.e. instead of:

Field Value : Is Equal To  : 0

It would be:

Field Value : Is Equal To : “None”

 

Do you like this tip? Subscribe to my Newsletter to receive tips via email. Click Here to subscribe.

 

www.simply-access.com (c) 2002 - 2009