FormatConditions Entire Row

P

Phil

Does anyone know how to tchange the color of all fields
in on row of a form?

Using the code below in the CurrentRecord of the form, I
can get a single field's Unique value to turn yellow, but
I also need the entrie row to turn yellow. The fields in
the rest on the row may not be Unique.

Private Sub Form_Current()

Dim fcd As FormatCondition

With Form_frmTransactions_SGH.CCN
With .FormatConditions
.Delete
Set fcd = .Add(acFieldValue, acEqual, "'" &
Form_frmTransactions_SGH.CCN & "'")
fcd.BackColor = vbYellow
End With
End With

End Sub

Thanks, phil
 
M

Marshall Barton

Phil said:
Does anyone know how to tchange the color of all fields
in on row of a form?

Using the code below in the CurrentRecord of the form, I
can get a single field's Unique value to turn yellow, but
I also need the entrie row to turn yellow. The fields in
the rest on the row may not be Unique.

Private Sub Form_Current()

Dim fcd As FormatCondition

With Form_frmTransactions_SGH.CCN
With .FormatConditions
.Delete
Set fcd = .Add(acFieldValue, acEqual, "'" &
Form_frmTransactions_SGH.CCN & "'")
fcd.BackColor = vbYellow
End With
End With

End Sub

Sorry but I don't recognize what you're doing there. It
sort of looks like you're manipulating the format conditions
of a control, but I can't figure out why. Maybe you just
got started down a twisty path? or maybe I don't understand
what you're trying to do.

To make the entire detail section of a form display a
conditional background color, first make all of the
section's controls BackStyle Transparent. Then add a
rectangle control the same height and width as the entire
section, use the Formst Send to Back menu item to place it
behind all the other controls. Now you can use Conditional
Formatting on the one rectangle control to control the color
of the entire section.
 
S

Stephen Lebans

Also it kinds of defeats the purpose of CF to modify it on every Current
event.

Marshall due to a bug in CF you have to setup the FormatConditions
object programmatically in order to ensure that the background TextBox
control's Enabled property setting will be respected. Sample code here:
http://www.lebans.com/conditionalformatting.htm

Just my $.02
 

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