Re: Color Code report - go through each row, compare with previous record, if different, highlighted all fields in the current row

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Nov 7, 4:28 pm, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx> wrote:
The code changes the ForeColor to Bule at the first record.

There's nothing there to change it to anything else.
Did you need an Else block?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<richiech...@xxxxxxxxx> wrote in message

news:1194480177.933859.210910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



On Oct 19, 5:58 pm, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx> wrote:
You can do this withcodein the report's events.

1. Declare a variable in the General Declarations section of the report's
module (at the top, with the option statements.)

2. In the Print event procedure of the (Detail?) section, store the
current
record's value to the variable.

3. In the Format event procedure of the same section, compare the current
record's value to the variable, and change the ForeColor/BackColor or
whatever you want formatted.

<richiech...@xxxxxxxxx> wrote in message

news:1192815866.203341.267480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi, I am working on a customize report. The datasource for the report
is filled bycode. I am wondering if it's possible for me to
highlight rows with if one field of current record is different from
the previous record. The report is currently sorted in a specific
order.

Thanks for help!- Hide quoted text -

- Show quoted text -

Sorry I wasn't able to get it working. Below is my code. Basically
it changed everything to blue, and I found out when it's run to
Sub_Detail_Format, the CurrentStyleNum is always "".

My question is, will this run Sub_Detail_Print and then
Sub_Detail_Format for each records, or it runs all the records for
Sub_Detail_Print and then run all the records for Sub_Detail_Format.

Thanks for your help,

Dim CurrentStyleNum As String
------------------------------------------

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [StyleNum] <> CurrentStyleNum Then

[StyleNum].ForeColor = vbBlue

End If

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

CurrentStyleNum = [StyleNum]

End Sub- Hide quoted text -

- Show quoted text -

Great, it works!

Thank you very much.


.



Relevant Pages