Dynamic Lines (Table) in Reports (1 Viewer)

GaryC

Registered User.
Local time
Today, 15:01
Joined
Apr 25, 2001
Messages
31
Help - need to draw a table in access using verticle lines drawn dynamically at report run time using the On-Page event.

Trouble is I don't know the verticle length in advance. I can use a verticle 'bottom' value = 18.3 to draw a line to just above my footer, but need it to stop at bottom of 'detail' section when the size of 'detail' and 'footer' are using 'can grow' = yes.

I have re-produced my feeble attempt below - can anybody tell me what I am doing wrong !

Private Sub Report_Page()
Dim asglPos(20) As Single
Dim sglTop As Single, sglBottom
'Set up Positions for Boxes
asglPos(0) = 0
asglPos(1) = 4.1
asglPos(2) = 11.5
asglPos(3) = 16.5
asglPos(4) = 24#
asglPos(5) = 26.4

If Me.Properties("acHiddenCurrentPage") = 1 Then

sglTop = (Me.Section(1).Height / 567) + 1#
Else
sglTop = 1#
End If

'sglBottom = 18.3 ' to draw to fixed footer - works OK
'but need 'dynamic' length
sglBottom = (Me.Section(acPageHeader).Height + Me.Section(acDetail).Height) / 567 + 1#

Me.DrawWidth = 1
'Always draw Vertical Lines
For intCount = 0 To 5
Me.Line (asglPos(intCount) * 567, sglTop * 567)-(asglPos(intCount) * 567, sglBottom * 567)
Next intCount
Me.Line (0, sglTop * 567)-(asglPos(5) * 567, sglTop * 567)
Me.Line (0, sglBottom * 567)-(asglPos(5) * 567, sglBottom * 567)

End sub

Any help would be appreciated !!

Thanks in advance.
 
R

Rich

Guest
Is this any help?
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer


intLineMargin = 60


For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail

Me.Line ((.left + .Width + intLineMargin), 0)-(.left + .Width + _
intLineMargin, Me.Height)

End With
Next
With Me
Me.Line (0, 0)-Step(.Width, .Height), 0, B
End With

Set CtlDetail = Nothing

End Sub
 

GaryC

Registered User.
Local time
Today, 15:01
Joined
Apr 25, 2001
Messages
31
Thanks Rich,

Sorry for delay in getting back - was up the hospital all yesterday.
Works a treat ! - I new it there had to be a simple way to do it - just need to tidy it up now and can have a early finish today.

Cheers

Gary
 

Users who are viewing this thread

Top Bottom