Link to home
Start Free TrialLog in
Avatar of LenaWood
LenaWood

asked on

Horizontal Report Line

My boss wants to make a report look more like a form by putting a border around sections in the report.  I have done so using the following code:

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


HOWEVER, if the detail section goes over to a second page, there is no bottom line on the first page. Right now the bottom line is drawn in so it appears at the bottom of the section (whatever page the section ends on).

How do I get it on the bottom of the page if the detail section flows over.

Thanks!
Lena
Avatar of LenaWood
LenaWood

ASKER

Is this not possible or did I ask the questions wrong?

Thanks!
Lena
Couldn't you put a line at the top of the page footer?

Of course, if you didn't want it to always appear at the bottom of the page then you would have to add some code to determine when it should display and when it shouldn't.  You would obviously want it to display on the first page if the report were going to be more than one page, but you wouldn't necessarily want it to display on the last page.

The other option would be to have a line after every record, but only make the line visible every X records.  Where X is the number of records that appear on a single page.
jlawhorn,

Each finding (which is a record) is started on a new page so the line between records would do me no good.

I thought about putting the line in the footer...and would do that if I could make the lines that are drawn in the details section go clear to the bottom of of the page no matter where the detail section actually ended.  Then the line in the footer wouldn't ever be out of place.

Any other ideas?

Thanks for your help!
Lena
Hmm.  I see the problem.  

How about page breaks?  If you defined your detail section to be 9" and put a page break at the very bottom, it would force your lines to be a full page (depending on the size of your page header and footer) and it would also force a new page for those records that went over one page.  Then you could define your other line at the top of the page footer.
How do I do page breaks and define my section to so tall?

Each page has the same information at the top (in the page header) so the detail section would always be the same height.

Thanks!
Unfortunately, you can't set height programmatically because it's a read-only property at that point (On Format).

However, if you view the report in design mode, you can right-click on the Detail section, select Properties.  On the Format tab you can change the height.

As for page breaks...  You may not need them once you change the height of your detail section.  But if you do, they're part of the Toolbox Toolbar in design view.
I had tried adjusting the detail section in design mode before and it didn't seem to work.  It would cause problems if for some reason down the road the header was able to change sizes depending on what information was needed to be added.

I will however give it a try and award you with the points if it works the way I need it too.

I really appreciate all your help.
Lena
ASKER CERTIFIED SOLUTION
Avatar of jlawhorn
jlawhorn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Adjusting the details section made the report a mess and didn't work.

I have tried creating a main report and a subreport with no luck, I tried making the details section bigger with no luck.  I did find a bit of code that does what I want, but doesn't seem to work the way I had hoped with my report.

At this point, I am going to have to go to my boss and tell him his "Bottom Line" is going to have to be missing when his reports are too wordy for one page.

I appreciate the efforts.  What do I do with the question now?  I didn't really get an answer...I want to be fair about it, so please let me know what to do.

Thanks,
Lena
Sorry I couldn't help.  I won't be offended if you ask the moderators for a refund on your points.  (I can't remember how to do it, but I know there's something in the FAQ's).  Hope the conversation with your boss goes ok.
Talk went ok...just told him his bottom line was going to be blank if he got mouthy hehehe.  I don't have a problem giving you the points if that is the protocol...I want to be fair.

Lena
I awarded you the points because after thinking about it, you did your very best to help me out.

Have a great weekend.
Lena
FYI - I found a solution - actually an instructor in a class I am taking found the answer for me.

FooterLine.Visible = Me.Section("Detail").WillContinue

Or

    If Me.Section("Detail").WillContinue = True Then
        FooterLine.Visible = True
    Else
        FooterLine.Visible = False
    End If

Which says the same thing just a different way.