Adding Lines to Database Report

SantasLittleHelper

Board Regular
Joined
Nov 25, 2016
Messages
77
Is there a way of adding a horizontal line on the access report after every 15 records?
E.g.
Client 13
Client 14
Client 15
__________
Client 16
Client 17
....
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Well, you can underline your values using Conditional Formatting.

First, add a Counter to the Detail section of your Report to count each record.
Follow Allen Browne's directions for Reports at the top of this article here: Microsoft Access tips: Numbering Entries in a Report or Form
Let's then name this Text Box "txtCounter".

Now, go to the field you want to underline, right-click on it, and select Conditional Formatting.
Under "Condition 1", change the drop-down box to "Expression Is" and enter this formula:
Code:
[txtCounter]/15=Int([txtCounter]/15)
Then select the underline option.

You can do this for other fields too, if you are showing more than one. Just repeat the same Conditional Formatting steps with those fields.

Note that if you do not actually want to see the counter on the report, just change the Visible property of that "txtCounter" Text Box to "No".
 
Last edited:
Upvote 0
It is very easy.

1) add a textbox to the row.

Control Name: txtCount
visibel= No
control source:=1
Runnig sum: Over All

2) add a line to the row below the controls

Control Name: MyLine

3) In the detail section's "On Print" event add an [Event Procude]

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   ' make the line visible after each group of 15 records
   MyLine.Visible = ((Me.[txtCount] \ 15) * 15 = Me.[txtCount])

End Sub

TIP: The trick is to use integer division with \ not /.

Me.[txtCount] \ 15 is the same as Int(Me.[txtCount] / 15)
 
Last edited:
Upvote 0
Oh sure Boyd, now you come along!
After over 32 hours of the question being unanswered, you answer the same hour that I do!
I spent some time trying to figure out if one could apply Conditional Formatting to lines (it appears not), and didn't even consider going the VBA route instead.
You could have come along an hour earlier and saved me the trouble!!! ;)
 
Upvote 0
Oh sure Boyd, now you come along!
After over 32 hours of the question being unanswered, you answer the same hour that I do!
I spent some time trying to figure out if one could apply Conditional Formatting to lines (it appears not), and didn't even consider going the VBA route instead.
You could have come along an hour earlier and saved me the trouble!!! ;)


We must have seen this abut the same time. I was testing my theory also. While testing the phone rang and I was delayed about an hour. Otherwise, we probably would have posted a reply about the same time.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,351
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top