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

Negatives in red 2

Status
Not open for further replies.

TadyB

Programmer
May 21, 2004
42
US
I'm running a cash register type program.
On my form, I have a text box to calculate the change for an order: amount tendered minus the total which is done in the Control Source in the text box properties. When less money is given than the total, the change field shows the negative in parenthesis. Is it possible to modify this to show the negative amount in red to make it more obvious that enough money wasn't given?

Thanks,
Stacey
 
If you have Access 2000 or newer, you can use conditional formatting.

With your form in design view, select the control and then format and conditional formatting... will be one of the choices that drops down.



HTH,
Bob [morning]
 
Thanks, but I don't think it's working. I tried setting the field value to red if it is less than 0, but it doesn't seem to see a negative number. I'm thinking it's because the number is in parenthesis, it doens't have the "-" it's probably looking for.
Did I do something wrong?

Thanks again,
Stacey
 
Hi Stacey,

I don't think that's the problem because (number) is one option used to represent negative numbers. Since it's not possible to cut/paste the conditional formatting window here, suggest you look up the feature in Access help.

Post back if you don't figure it out.



HTH,
Bob [morning]
 
What code are you using to determine if the number is negative?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
The code I am using for the text box, AmountTendered, in Control Source is:
=[AmountTendered]-[Total]

I can use any other condition except less than. It works for greater than and equal to, etc. I even changed to Format properties from currency to General Number.

I put the conditional formatting on another field that didn't have a calculation and it works fine...so, it's the way I did the calculation. Any guesses?

Thanks Bob for the tip, I've never had to use conditional formatting before...learn something new every day. (I'm a self-taught user :) )

Stacey
 
Why not just use the Format property with the appropriate colors that you want. Here is an example:

Code:
$#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"

Check out ACCESS Help for Format property for the specifics of number/currency formatting.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
You can also try making a new text box to reference your calculation box and retest the conditional.

textbox1=[AmountTendered]-[Total]
textbox2=textbox1

then put your conditional on textbox2.

If "field value" "is LESS than" "0"
then choose you values.

It should work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top