Subreport is not showing horizontal lines

J

JoJo

Can someone please help me figure out why the horizontal lines are not
showing up in the subreport? Below is the code for vertical and horizontal
lines used in a report for a subreport that was put into a report. The
regular report is a one column report with the subreport being a two column
report. The vertical lines in the code of the report are showing up just
fine but for some reason there is only one horizontal line showing up in the
report header of the report (not subreport). Does this make sense? Here is
the code.

Me.Line (0.0001 * 1440, 3449)-Step(0, 3350)
Me.Line (0.6856 * 1440, 3449)-Step(0, 3350)
Me.Line (1.2 * 1440, 3449)-Step(0, 3350)
Me.Line (2.9 * 1440, 3449)-Step(0, 3610)
Me.Line (3.58 * 1440, 3449)-Step(0, 3610)
Me.Line (3.85 * 1440, 3449)-Step(0, 3350)
Me.Line (4.6 * 1440, 3449)-Step(0, 3350)
Me.Line (5.1144 * 1440, 3449)-Step(0, 3350)
Me.Line (6.8144 * 1440, 3449)-Step(0, 3610)
Me.Line (7.51 * 1440, 3449)-Step(0, 3610)


Dim intNumLines As Integer
Dim intLineNum As Integer
Dim intDetailHeight As Integer
Dim intPageHeadHeight As Integer
On Error GoTo Report_Page_Error

intNumLines = 14
intDetailHeight = Me.Section(acDetail).Height
intPageHeadHeight = Me.Section(3).Height
For intLineNum = 1 To intNumLines
Me.CurrentY = (intLineNum) * intDetailHeight + intPageHeadHeight
Me.CurrentX = 0
Me.Line (0, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(Me.Width, 0)
Next
On Error GoTo 0
Exit Sub

Report_Page_Error:
Select Case Err
Case 2462 'no page header
intPageHeadHeight = 0
Resume Next
End Select
MsgBox "Error" & Err.Number & "(" & Err.Description & _
")in procedure Report_Page of VBA Document Report_Report1"

Thank you ever so much!
 
D

Duane Hookom

The On Page event never fires in a subreport. You would need to use another
event or find another solution.
 
J

JoJo

First let me say that I meant the vertical lines are showing up fine in the
subreport but the horizontal lines aren't. Only one vertical line is showing
up in the report header of the regular report. Okay, do you have a solution?
I am leaving my job to move out of state and only have a few days left, so
if you could help me with this it would be much appreciated.

Thank you!
 
J

JoJo

--
MADBLover


JoJo said:
First let me say that I meant the vertical lines are showing up fine in the
subreport but the horizontal lines aren't. Only one horizontal line is showing
up in the report header of the regular report. Okay, do you have a solution?
I am leaving my job to move out of state and only have a few days left, so
if you could help me with this it would be much appreciated.

Thank you!
 
J

JoJo

Another thing I need to correct is that the code is actually in the regular
report not in the subreport. Thanks
 
D

Duane Hookom

I would first try comment out
intPageHeadHeight = Me.Section(3).Height
I would also add some debugging code to see if the code is firing.
 
J

JoJo

What about the other intPageHeadHeights in other parts of the code? Should
they come out? How do you add and what is debugging code?
 
D

Duane Hookom

I answered before you stated the code was in the main report. Your earlier
statements confused me since I didn't think they would fire in a subreport.
To debug, you would add a line of code to display a message box or write
something to the debug window like:

MsgBox "The On Page of the Subreport is Firing"
or
Debug.Print "The On..."
 
J

JoJo

I'm so sorry for causing confusion, I tried to go back and correct myself
before the message posted but it was too late. I'm going to try commenting
out the intPageHeadHeight = Me.Section(3).Height and add the debug statement
then I'll get back with you to let you know how it went . Thanks for
volunteering your time, I know it must be a challenge to deal with people who
don't know, but like to think they know, what they're doing.
 
D

Duane Hookom

If the code is in the main report then you shouldn't need to comment out the
line.
 
J

JoJo

Thanks Duane, I finally got it figured out. I took out the other code and
put in the new code below. It's probably not the best but it worked. I put
it in the main reports OnPage event.

Private Sub Report_Page()
Me.Line (0.0001 * 1440, 3449)-Step(0, 3675)
Me.Line (0.6856 * 1440, 3449)-Step(0, 3675)
Me.Line (1.2 * 1440, 3449)-Step(0, 3675)
Me.Line (2.9 * 1440, 3449)-Step(0, 4000)
Me.Line (3.58 * 1440, 3449)-Step(0, 4000)
Me.Line (3.85 * 1440, 3449)-Step(0, 3675)
Me.Line (4.6 * 1440, 3449)-Step(0, 3675)
Me.Line (5.1144 * 1440, 3449)-Step(0, 3675)
Me.Line (6.8144 * 1440, 3449)-Step(0, 4000)
Me.Line (7.475 * 1440, 3449)-Step(0, 4000)
Me.Line (0 * 1440, 3730)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 3730)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 4000)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 4000)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 4260)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 4260)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 4530)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 4530)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 4800)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 4800)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 5080)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 5080)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 5350)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 5350)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 5630)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 5630)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 5920)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 5920)-Step(3.619 * 1440, 0)
Me.Line (0 * 1440, 6220)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 6220)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 6520)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 6520)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 6820)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 6820)-Step(3.62 * 1440, 0)
Me.Line (0 * 1440, 7120)-Step(3.58 * 1440, 0)
Me.Line (3.85 * 1440, 7120)-Step(3.619 * 1440, 0)
Me.Line (2.9 * 1440, 7445)-Step(0.675 * 1440, 0)
Me.Line (6.8144 * 1440, 7445)-Step(0.673 * 1440, 0)
End Sub

If you have a shorter method I'd be glad to see it. Thanks again for your
help.
 
D

Duane Hookom

If there is a repeating pattern or interval, I generally will write code that
uses a For Next loop. I sometimes place invisible controls on the report to
use as start points and set their Tag property to some value. I can then loop
through the controls to find particular tag values and draw lines based on
the Top and/or Left properties of the control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top