ForeColor

J

Joe

Hello All,

I need help trying to figure out why my code is not working. If my
check_amt is less than zero then the forecolor should be Red otherwise black.
However, all my records are red even when the amount is greater then 0. The
Code is on the Form_Open Event.

If Me.CHECK_AMT < 0 Then
Me.CHECK_AMT.ForeColor = 255
Else
Me.CHECK_AMT.ForeColor = 0
End If

I sure its something simple but I just can't get it to work :-(
 
B

Beetle

First, the Form Open event is the wrong event for this.
You would normally use the Form Current event, but it
sounds like you are using a continuous form, so doing it
in code won't work. You need to use Conditional Formatting.

In design view, select the text box in question, go to
Format/Conditional Formatting, in the Condition1 drop down
select Field Value Is, enter > 0 in the text box, then select
a red forecolor for the condition.
 
J

Joe

Thanks Beetle,

I have never used the Conditional Formatting before. That is a really
helpful tip since I would nornamlly try to use vb in cases like this.

Thanks
 

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