Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2001
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic report lines (Access 97 SR 1)

    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.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamic report lines (Access 97 SR 1)

    This is how I do it - since my routine is generic, I use invisible lines whose names start with "vLine" as placeholders in my reports to tell the routine where to draw the real lines. I then put

    call drawvline(me)

    in the Print event for all my reports.

    <pre>Public Sub DrawVLine(ByVal Rept As Report) 'Rept will invariably be Me
    Dim cLine As Control 'For stepping through every control in the report
    Dim xPos As Single 'x coordinate of line (in twips)
    Dim yHt As Single 'y height (in twips)

    For Each cLine In Rept.Controls 'Step through every control in report
    If cLine.ControlType = acLine And Left(cLine.Name, 5) = "vLine" Then 'Find all lines named vLine...
    xPos = cLine.Left 'x position of line
    yHt = Rept.Height 'height of detail section
    Rept.Line (xPos, 0)-Step(0, yHt), 0 'Draw vertical line at xPos,0 of height yHt in black (colour 0)
    End If
    Next

    End Sub
    </pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •