Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2010
    Posts
    186

    Unanswered: Vertical lines on a report not growing

    Thanks for viewing my post!
    I adapted the code below from MS Support to create 4 vertical lines in the detail section of my report. I need these 4 lines to extend the length of detail section.

    The bottom is report footer section, which I need to sum - not a page footer. The lines need to meet the report footer.........which has a set position from the top of the page.

    This code creates the 4 lines, but height is only as high as the records. Detail section is set to Can Grow.
    Need some help with another set of eyes on this to see what I am missing.....appreciate whatever input you can provide!

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    Me.ScaleMode = 1
    Me.ForeColor = 0
    Me.Line (1.5417 * 1440, 0)-(1.5417 * 1440, 14400), vbRed
    Me.Line (4.6667 * 1440, 0)-(4.6667 * 1440, 14400), vbRed
    Me.Line (6.4583 * 1440, 0)-(6.4583 * 1440, 14400), vbRed
    Me.Line (8.25 * 1440, 0)-(8.25 * 1440, 14400), vbRed


    End Sub

    Private Sub Report_Open(Cancel As Integer)

    DoCmd.Maximize

    End Sub

    Private Sub Report_Page()

    If Me.Page <> 1 Then

    Me.ScaleMode = 1
    Me.ForeColor = 0
    Me.Line (1.5417 * 1440, 0)-(1.5417 * 1440, 14400), vbRed
    Me.Line (4.6667 * 1440, 0)-(4.6667 * 1440, 14400), vbRed
    Me.Line (6.4583 * 1440, 0)-(6.4583 * 1440, 14400), vbRed
    Me.Line (8.25 * 1440, 0)-(8.25 * 1440, 14400), vbRed
    End If

    End Sub

    Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    Call SetGrpFtrLoc(Me.Report, 6) 'Display report footer at least
    '6 inches from the top of the page
    Me!Label90.Visible = Not IsNull(Me!CITAX)
    Me!Label92.Visible = Not IsNull(Me!CIFRT)
    End Sub

    Private Sub Report_Close()
    DoCmd.Restore
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    would it not be easier just to set the end of the line to the top+height of the largest control?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2010
    Posts
    186
    Yes - I've done some math and changed the twips to 9720

    I've run 2 tests:
    *print preview on a report with multiple records in detail - and the line runs as long as the records, Not to the report footer. Report footer is in place.
    *print preview on a report with a single record - and the line runs as long as the record and leaves the rest of the first page blank, then runs multiple pages with the lines on it from the bottom of the top margin to the top of the report footer. There are so many pages I can't get to the report footer.....it freezes on formatting

    Should I be using the margins in the math?

    I feel like Page <> 1 is not the correct code for If statement........I want these lines whether there is one record or multiple records to appear on the first page to 9720 twips

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    sorry you are messing around with magic numbers
    if you want a vertical line within a reports detail section to extend to the same depth as the controls on your report
    10 plonk as many line controls as you need, set the left dimension as required, set the top all to be 0
    1) work out what the biggest control on your detail section is
    2) then set the height of each vertical line to be the same as that controls top + height
    do this inside the reports on format event
    if you need those lines in section headers and or footers then copy then to there, and set an appropriate height. if you need to adjust the height in thosze sections then its no different to the earlier approach. in the relevant section(s) adjust the height of the line controls to the height + top of the biggest control
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2010
    Posts
    186
    Does this mean I am telling VBA what to do with line controls I have in detail section?
    I did not have controls in the detail section at all, I was using OnPrint to create the lines in VBA.

    How do I adapt the VBA to trigger line controls (Line118, 119, 120 and 121)
    These are the exact sizes I need:
    Me.Line (1.5417 * 1440, 0)-(1.5417 * 1440, 9720), vbRed
    Me.Line (4.6667 * 1440, 0)-(4.6667 * 1440, 9720), vbRed
    Me.Line (6.4583 * 1440, 0)-(6.4583 * 1440, 9720), vbRed
    Me.Line (8.25 * 1440, 0)-(8.25 * 1440, 9720), vbRed

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    as said before
    you are messing with magic numbers there
    my suggestion is to define line controls in the form design
    then adjust the height of those line controls as required
    if you choose to create controls ont he fly using values that are hard to decypher you make it harder for yourself to debug
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Jun 2010
    Posts
    186
    very pleased! with much playing around I was able to secure vertical lines that grow in the retails section . Score!
    this is the VBA I got to work:

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    Me.ScaleMode = 1
    Me.ForeColor = 0
    Me.Line (1.5417 * 1440, 6000)-(1.5417 * 1440, 10080), vbRed
    Me.Line (4.6667 * 1440, 6000)-(4.6667 * 1440, 10080), vbRed
    Me.Line (6.4583 * 1440, 6000)-(6.4583 * 1440, 10080), vbRed
    Me.Line (8.25 * 1440, 6000)-(8.25 * 1440, 10080), vbRed


    End Sub

    So I need to play around with a new issue:
    Where can I specify that I want a 1pt line inVBA? I managed to get red...now I need 1pt.
    On screen it's ok looking, but when I print it out it is hairline in the extension - 1pt as next to record controls.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    here's a radical idea:-
    use controls.

    then you can change whatever properties you need as and when you need
    without messing around with magic numbers, without affecting other properties on the form
    without changing the scalemode

    1pt will effectivley be a hairline line
    I'd rather be riding on the Tiger 800 or the Norton

  9. #9
    Join Date
    Jun 2010
    Posts
    186
    I don't know the VBA to get line controls to extend to the report footer.......
    all my research digs up the code letting VBA create the lines.
    I would love line controls!

Posting Permissions

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