Changing BackGround Color in a SubForm

sales@scantechintl.com

Registered User.
Local time
Today, 16:19
Joined
Oct 31, 2000
Messages
24
Hi,
In a subform, where several records are displayed, I would like to change the background color for the current control in the current record.

I tried the following:
---On Enter---
Private Sub Job_Enter()
ActiveControl.BackColor = Yellow
End Sub

---On Exit---
Private Sub Job_Exit(Cancel As Integer)
ActiveControl.BackColor = White
End Sub

The problem is that it changes the color for the control in all of the displayed records in the sub form.

Is it possible to limit it to the current or active record only?

John
 
In design mode of the form, click on the
field. Click format from the menu and then conditional formatting. You can enter an expression for that field and the background color when the expression evaluates to true. I think that is what your looking for.
Ryan J
 
Ryan,
It works like a charm. I didn't know about the conditional formatting.

Actually, the "Field Has Focus" option eliminates the need to write an expression.

Thanks for your help
John
 

Users who are viewing this thread

Back
Top Bottom