View Full Version : Changing BackGround Color in a SubForm


sales@scantechintl.com
11-13-2000, 08:09 AM
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

rjohnstone1
11-13-2000, 11:50 AM
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

sales@scantechintl.com
11-14-2000, 12:10 PM
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