Horizontal Shading in Report Detail - Access97 (1 Viewer)

KKilfoil

Registered User.
Local time
Today, 04:56
Joined
Jul 19, 2001
Messages
336
Sorry if this has been asked and answered....

I have a report that may output up to 25K records on plain white stock paper. (Occasional hardcopy of entire database to satisfy ISO). To keep the number of pages to a minimum, I have reduced the vertical height of the detail section to a minimum.

Now it is rather difficult to scan across the same row on the report.

I want to 'shade' the background of the detail for 4 rows, 'unshade' the next 4 rows, etc... for the entire report. This should provide enough visual cue to keep the eyes from straying up or down the page as one scans across. This would seem to be a commonly desired formatting option, but Access97 does not seem to offer it.

I expect some code needs to go into my OnPrint report event, but I am unsure about the simplest way to do this.

Anyone already solved this?
 

tjs206

Registered User.
Local time
Today, 09:56
Joined
Sep 25, 2000
Messages
37
I don't know about every 4 records, but if you want to shade every other record in your report, try this code.

Remember, you want the code to be in the same section that the records are located. For example, your records are mostly likely contained in the detail section of the report. If so, this would be the code of the OnPrint event of the detail section:

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

Const conLtGray = 13816530

If Detail.BackColor = conLtGray Then
Detail.BackColor = vbWhite
Else
Detail.BackColor = conLtGray
End If


Hope this helps. . .

tjs206

[This message has been edited by tjs206 (edited 10-24-2001).]
 

KKilfoil

Registered User.
Local time
Today, 04:56
Joined
Jul 19, 2001
Messages
336
Thanks for your reply.

However, I had already tried a toggle on/off each time approach similar to what you have suggested, but my user group told me that it was too 'busy' and that 4 or five records per 'color band' would look much better. Sigh.

For the time being, I have added a bit of height to the detail section and a horizontal line to separate records. Its okay so long as they are only printing a filtered subset of the table. Unfortunately, every six months, the full table report will go from being 900 pages long to 1200 pages long due to the extra height I added. I was trying to cut down on the wastage, since this report tends to go straight to the paper archive, rarely to be seen again! ISO9000 is a wonderful thing


Anyone know of a way to get wider horizontal shading on a report? I do have several other reports where this technique would be useful.
 

pdx_man

Just trying to help
Local time
Today, 01:56
Joined
Jan 23, 2001
Messages
1,347
Give this a try.


Option Compare Database
Option Explicit
Dim i As Byte
Dim NowWhite As Boolean

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

If i = 4 Then
If NowWhite Then
Me.Detail.BackColor = vbYellow
Else
Me.Detail.BackColor = vbWhite
End If
NowWhite = Not NowWhite
i = 0
End If
If FormatCount = 1 Then i = i + 1

End Sub

Private Sub Report_Open(Cancel As Integer)

i = 0
NowWhite = True

End Sub
 

KKilfoil

Registered User.
Local time
Today, 04:56
Joined
Jul 19, 2001
Messages
336
With a little tweaking, that worked fine!
Thanks a lot.
 

Users who are viewing this thread

Top Bottom