changing foreground color?

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

Hi,

I've got a continuous form and I want to change the foreground color of
a textbox depending on its value.

I tried the following:

Private Sub Form_Current()

If Me.Etat <> "entrée" Then
Me.Etat.ForeColor = 0
Else
Me.Etat.ForeColor = 255
End If

End Sub

But this doesn't work right. It only works for the first record in the
list!? How can I tell Access to check this for EVERY record in the
continuous list?

Thanks a lot!

Jerome
 
Jerome,

You can't do this on a continuous view form, as the code applies to the
control for all records. You should use Conditional Formatting instead.
Select the Etat control in design view of the form, select Conditional
Formatting from the Format menu, and complete the details as required.
 
Ok, thanks a lot! I wasn't aware of Conditional Formatting ... you learn
something new everyday! :)
 

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

Back
Top