Change datafieldcolor by a different field

J

johan

Hello,

I have a report with a list of one datafield (sort ascending).
When the datafield is different then the record above it, I want a
different backgroundcolor of it.

Example:

record 1 "aaa" (backgroundcolor yelow)
record 2 "aaa"
record 3 "bbb" (backgroundcolor yelow)
record 4 "ccc" (backgroundcolor yelow)
record 5 "ccc"

Somebody can help me out ?

Regards,
Johan
 
P

Pieter Wijnen

Something like

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Static LastValue As String
If Me.TheField.Value <> LastValue Then
Me.TheField.Backcolor = 255 ' Red
LastValue = Me.TheField.Value
Else
Me.TheField.Backcolor =0
End if

End Sub

HTH

Pieter
 
J

johan

Thanks Pieter, but.......

I put the module in the form as an "FormOpen" module.
In the form I have now 3 columns and (for example) 6 records.
The first datafield is called "TheField" (in the proporties).

When opening the form I should see :
column.1 column.2 column.3
A * B C
B * B C
B C A
C * D A
D * B B
D A C

* means that this datafield should be colored because it's a different
value then the value next in the same column.

The module now gives me a colored field on all the records in the
first column. It should be only the one with the asterix.

What I'm doing wrong ?

regards,
Johan
 

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