Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

group every 5 records on report 1

Status
Not open for further replies.

revilord

Programmer
Oct 2, 2003
64
I am trying to produce a report that has three comlumns. The issue I have is I want to put a border around every group of five records. The records aren't grouped in any particular way it's just they are easier to read if there is not a border around each record. I have tried to put a representation of it below of what one column should look like.

__________________
|h1|h2|h3_______|h4| Header section
|1 |2 |line 1............4 | Detail section
|1 |2 |line 2............4 |
|1 |2 |line 3............4 |
|1 |2 |line 4............4 |
|1 |2 |line 5............4 |
|__________________|
|1 |2 |line 6............4 |
|1 |2 |line 7............4 |
|1 |2 |line 8............4 |
|1 |2 |line 9............4 |
|1 |2 |line 10..........4 |
|__________________|
 
Perhaps another approach is to user code to reverse color groups. I;ve done that in the past. You could modify the code below and create a variable that holds a counter and resets after 5. htwh,


MS Access Reports - SMedvid

This will give a green bar effect on a report. Every other line green. You may want to play around with the numeric color expressions if you don't like the loud green you get from vbGreen. Just a tip...

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

If Me.Detail.BackColor = vbWhite Then
Me.Detail.BackColor = vbGreen
Else
Me.Detail.BackColor = vbWhite
End If

End Sub



MichaelRed (Programmer) Jul 12, 2004
Somewhat easier:

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

'Michael Red. 2/13/2002. To 'Toggle the backolor, which
'Provides alternate line shading
Const XorToggle = 4144959

Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle

End Sub

Of course, the const used in this provides a light grey, but you can use a different constanta and get any color desired.

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
If you want to try this, you might get it to look fairly nice. On your report, add two lines, one horizontal and one vertical. The horizontal and vertical lines will in effect form a box around EACH record. The add another textbox. Set it's Visible property to No, set it's Control Source to =1 and set it's Running Sum property to Over All (Over Group might work better depending on your data). Then in the Detail Section Format Event put this code.

If Me.RunningSumTextbox Mod 5 = 0 Then
Me.HorizontalLineNumber.Visible = True
Else
Me.HorizontalLineNumber.Visible = False
End If


This will get you close. You may have to tweak the line placement and stuff, but my quick test seemed to work fairly well.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top