Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004

    Arrow Unanswered: Report Lines Needed

    Good Morning,

    I have created a report that needs a border put around the details section of the report.

    To do this I have used the following code to draw the lines down the sides:

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
              Dim X1 As Single, Y1 As Single
              Dim X2 As Single, Y2 As Single
              Dim X3 As Single, Y3 As Single
              Dim X4 As Single, Y4 As Single
              Dim Color As Long
              ' Specify unit of measurement for coordinates on a page...
              Me.ScaleMode = 5 ' Specify that measurement occur in inches.
              ' Set line to print 5 inches from the left margin.
              'X1 = 5
              X1 = 0
              X2 = 0
              X3 = 6.5
              X4 = 6.5
              ' Set line to print from the top of the detail section
              ' to a maximum height of 22 inches.
              Y1 = 0
              Y2 = 22
              Y3 = 0
              Y4 = 22
              Me.DrawWidth = 30 ' Width of the line (in pixels).
              Color = RGB(0, 0, 0)  ' Use black line color.
              ' Draw the line with the Line method.
              Me.Line (X1, Y1)-(X2, Y2), Color
              Me.Line (X3, Y3)-(X4, Y4), Color
    End Sub
    This works great for lines going down the side. The line at the top is an easy one as I just drew a line and made it the right thickness. The line at the bottom of the section is another story.

    I added a line under the last field in the section area (many of the fields have their CanGrow and CanShrink values set to yes) of the right thickness so I can have the bottom line of my "rectangle". This works great unless there is enough information to cause the details section to expand to another page. When this happens there is no line at the bottom of each page that the detail section expands past. For example, if the details section is flows over to page 2, there is no line just above the footer of page 2.

    Ideally, I would like to have the vertical lines in the details section go from the top of the details section to the top of the page footer, no mater how much information is in the details section. This way I could have a line drawn at the top of my footer section that would "finish" my page border.

    I have been hunting for an answer to this question for several days. I have seen some examples this being done, but reading the VBA to make it happen is like reading Martian. I am hoping to find a simple easy way to get it done.

    Any help would be greatly appreciated.


  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    The way I have always done it is to use a Main report and a sub report. Essentially, your main report is any header information you have and the lines. So if you were showing customer purchases, the header would have information about the customer address etc. and the detail section would show dates, times and dollar amounts for purchase.

    With this format, the main report shows the header and the detail section is just a big rectangle. The key is to make the Detail section as large as it can be without going to two pages. You have to take into account the margins and headers and footer.

    The next step is to create a second subreport, with the detail data, then put it in your main report just under the top of the rectangle and allow it to grow and shrink.

    If you need column headings then you will probably want to add them to the rectangle in the main report.

    I done it quite a bit soe if you have any questions...

  3. #3
    Join Date
    May 2004
    Quote Originally Posted by DCKunkle
    The way I have always done it is to use a Main report and a sub report.
    Now that is an idea I hadn't thought of. I will give this a try. Thank you sooo much!


Posting Permissions

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