Make line visible last detail section on page

Pyro

Too busy to comment
Local time
Tomorrow, 01:36
Joined
Apr 2, 2009
Messages
127
Hi,

I am trying to make a line in a report visible in the last detail section on each page only. Is there a way to achieve this? I have spent hours playing with different ideas, but nothing...

I have looked into the HasContinued and WillContinue methods with no success.

Any thoughts would be much appreciated.
 
I have managed to achieve that which i set out to do.

Since in my searching, i came across several posts in various forums where people had asked similar questions about how to identify the final detail section on a page of a report without helpful responses, i thought that i would detail the technique that i used here, so that others may benefit.

First, declare a private variable in the module of your report
Code:
Option Compare Database
Option Explicit
[COLOR=yellowgreen]'String that will store each final detail section[/COLOR]
Private strLastDet As String

Next, in the On Format event of the page footer section, generate a string consisting of the last current record for each page delimited by a ","
Code:
[COLOR=yellowgreen]'Generate a string of final detail sections based on the current record[/COLOR]
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If InStr(Nz(strLastDet), Me.CurrentRecord) = 0 Then
    strLastDet = Nz(strLastDet) & Me.CurrentRecord & ","
End If
End Sub

Now in the On Print event of the detail section, split the string into an array, then draw the line when the current record matches each item
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
 
Dim varItem As Variant
Dim strItem() As String
 
[COLOR=yellowgreen]'Split the string into parts[/COLOR]
strItem = Split(strLastDet, ",")
 
[COLOR=yellowgreen]'Draw the line based on the current record[/COLOR]
For Each varItem In strItem
    If Me.CurrentRecord = varItem Then
        Me.Line (X, Y)-(X, Y)
    End If
Next varItem
 
End Sub

For me, this code contributed to drawing a border around a set of data that simulates a table that will grow or shrink depending on the number of records on your page(s).
 

Users who are viewing this thread

Back
Top Bottom