Verticle lines between columns

K

Kevin Wynkoop

I have a report where I am separating the columns of data with a line. I am
using a small vertical line the height of the detail and usually works well.
Once in a while, I have a field ("can grow" property set to "yes") with
enough data to grow. That makes the vertical line look "broken" all across
the row. Is there a way to make all the vertical lines extend their length
to match the new height of the detail when a field needs to grow to
accommodate its data? The width of the "growing" field can't be widened -
government proscribed format - and the font size is already at 8 point. Any
ideas?

Thanks,
Mike
 
S

strive4peace

Hi Mike,

this goes in the code behind your report

'~~~~~~~~~~~~~~~
Private Sub Report_Page()
'on error resume next
Dim x1 As Single, y1 As Single, x2 As Single
Dim y2 As Single, i As Integer

' ---------------------------------- Set scale to pixels.
Me.ScaleMode = 3
' ---------------------------------- Top inside edge.
x1 = Me.ScaleTop + 2
' ---------------------------------- Left inside edge.
y1 = Me.ScaleLeft + 2
' ---------------------------------- Width inside edge.
x2 = Me.ScaleWidth - 4
' ---------------------------------- Height inside edge.
y2 = Me.ScaleHeight - 4
' ---------------------------------- Draw line as a box.
'comment this out if you don't want a box around your page
Me.Line (x1, y1)-(x2, y2), RGB(150, 150, 150), B

' ---------------------------------- set scale to inches
'adjust y1 and y2 until you get them to look good on your report

Me.ScaleMode = 5
y1 = Me.ScaleTop + 0.9479
y2 = Me.ScaleHeight

'change 6 to the number of lines that you want
For i = 1 To 6
Select Case i
'make x1 the location of each line
Case 1: x1 = 2
Case 2: x1 = 3.7104
Case 3: x1 = 5.4208
Case 4: x1 = 7.1313
Case 5: x1 = 8.8417
Case 6: x1 = 9.4118
End Select
Me.Line (x1, y1)-(x1, y2), RGB(150, 150, 150)
Next i
'Me.Line (0, 0)-(14320, 10420), 8388608, B
End Sub

'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

Hi strive4peace,
l try it in my report. it done.thank you. but l still can't find my second
page report.

Hi Mike, Sorry if l disturb you
 
S

strive4peace

Hi Zila,

you're welcome ;)

I do not understand what you mean by this: "but l still can't find my
second page report."

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
 
K

Kevin Wynkoop

Thanks. This works great for the main page. How can I get it to work within
a sub report and end with the data in the sub-report? Putting it in the Page
code of the sub-report doesn't seem to draw any lines.

Thanks,
Mike
 
K

Kevin Wynkoop

Here is what I figured out:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'on error resume next
Dim x1 As Single, y1 As Single, x2 As Single
Dim y2 As Single, i As Integer

' ---------------------------------- Set scale to pixels.
' Me.ScaleMode = 3
' ---------------------------------- Top inside edge.
' x1 = Me.ScaleTop + 2
' ---------------------------------- Left inside edge.
' y1 = Me.ScaleLeft + 2
' ---------------------------------- Width inside edge.
' x2 = Me.ScaleWidth - 4
' ---------------------------------- Height inside edge.
' y2 = Me.ScaleHeight - 4
' ---------------------------------- Draw line as a box.
'comment this out if you don't want a box around your page
' Me.Line (x1, y1)-(x2, y2), RGB(150, 150, 150), B

' ---------------------------------- set scale to inches
'adjust y1 and y2 until you get them to look good on your report

Me.ScaleMode = 5
y1 = Me.ScaleTop ' + 0.9479
' y2 = Me.ScaleHeight
y2 = Me.Height / 1440
Me.DrawWidth = 3

'change 6 to the number of lines that you want
NumOfLines = 10
For i = 1 To NumOfLines
Select Case i
'make x1 the location of each line
Case 1: x1 = 2
Case 2: x1 = 2.375
Case 3: x1 = 2.875
Case 4: x1 = 3.375
Case 5: x1 = 4
Case 6: x1 = 4.625
Case 7: x1 = 5.5
Case 8: x1 = 6
Case 9: x1 = 6.5
Case 10: x1 = 7.325
End Select
Me.Line (x1, y1)-(x1, y2), RGB(0, 0, 0)
Next i
'Me.Line (0, 0)-(14320, 10420), 8388608, B
End Sub

I put this code in the print property(?) of the Detail section. By using the
Height property instead of the ScaleHeight property, it picked up the height
of the detail if it grew and drew the line the height of the new detail
section, which is exactly what I needed. Thanks for the help. I couldn't
have done it without you.

Thanks,
Mike
 
S

strive4peace

you're welcome, Mike ;) happy to help

thanks for sharing your solution

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

I used the code you provided to put a box around my report as well, and it
worked great, but the lines are so thin they are almost impossible to see
when printed. How can I increase the line thickness?

Thanks!
Sean
 
S

strive4peace

thanks, Marshall ;)

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
M

Marshall Barton

Well, you're welcome, Crystal, but truth to tell, this
appeared in my news reader as a new thread and I didn't even
notice that it was a reply to something you posted.
 
S

strive4peace

Hi Marsh,

:)

I don't see everything either...

the DrawWidth statement was in the code I posted... and set to 3 too ;)
but thanks for pointing it out so that Kevin knows what to adjust ;)
I'll be out of town for about a week, so please feel free to take over ;)

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

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