Color Coding Numbers

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Is there a way for the color to change on a number feild inside a form when
it reaches above or below a set ammount. Like if you set the cap at 30,000 as
long as the feild is below the cap it stays green, if it goes above it turns
red. Or its green while the number is a negative amount then red when a
positive amount.

Thanks, Ben
 
Ben,
If you're using A2000 or greater, you can use
Conditional Formatting to handle that.
or
Assuming a single form... and an text control named
FinalAmt,... you can set the color in the AfterUpdate event
of any field (or fields) that effect that FinalAmt.

If FinalAmt < 30000 Then
FinalAmt.Forecolor = vbRed
Elseif
FinalAmt.Forecolor = vbGreen
End Sub

You'll also need that same code in the OnCurrent event of the form
itself. That will handle the colors when browsing from one record to
another.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
With your form in design mode and the relevant textbox highlighted, click on
Format - Conditional Formatting on the menu bar.
Select your conditions & format colours accordingly and then save your form.
 
WOW thanks for the tip it work great, been working with access on and off for
about 3 years and I didn't realize that was there.

Thanks
 
Back
Top