The trick is to use conditional formatting to format a textbox in the
background.
Create a textbox named txtCurrent. Make it hidden and put it somewhere out
of the way (it could be in the header or footer).
Create another textbox in the detail section named txtBackGround. Set its
properties as follows:
Visible: Yes
Enabled: No
Locked: Yes
Border Style: Transparent
Special Effect: Flat
Back Style: Normal
Back Color: <whatever colour you want the un-highlighted rows to be>
Don't worry about size and position.
In your Form_Load event, position the textbox and make it fill the detail
section:
With txtBackGround
.Top = 0
.Left = 0
.Width = Me.Width
.Height = Me.Section(acDetail).Height
End With
In Form_Current, load the current record's primary key value into
txtCurrent:
txtCurrent = Me.[primary key field]
Now, select txtBackGround and set its conditional formatting:
Expression is: [txtCurrent]=[primary key field]
and select the desired fill/backcolor
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Sirocco said:
Well, it's been a while since my last visit. Anyway, anybody know if you
can highlight a row or field in a subform? I've tried various codes but
nothing works. Conditional formatting is good for formatting the
condition
field, but not otherwise. I'd like to format a field in a subform that's
not the condition field, how can I do this? Many thanks in advance.