Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vertical line between columns, full page length

516 views
Skip to first unread message

Sunrise

unread,
Jul 2, 2009, 9:01:01 PM7/2/09
to

I have a two-column report and would like to have one solid line between the
two columns.

I've tried adding a line in Design View but this only has the effect of
depositing a portion of a line beside each record. I'm looking for one long
continuous vertical line.

Any ideas?
--
Sunrise

fredg

unread,
Jul 2, 2009, 9:25:17 PM7/2/09
to

Look up the Line Method in VBA help.

Place the code below in the report's Page event.
Note: you may have to adjust the length of the line below.

Private Sub Report_Page()
Dim X1, Y1, X2, Y2 As Single
Me.DrawStyle = 0 ' a solid line

Me.DrawWidth = 1 ' set the thickness of the line

' Set the coordinates and draw a line down the middle of the page.

X1 = Int(Me.ScaleWidth / 2) ' find the middle of the page
Y1 = Me.Section(3).Height ' start just below the page header
X2 = X1 ' the line is vertical

' length of line is the length of the Page - (Height of the Page
' Header + Height of the Page Footer).

Y2 = Me.ScaleHeight - (Me.Section(1).Height + Me.Section(4).Height)

Me.Line (X1, Y1)-(X2, Y2) ' This draws the line

End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Sunrise

unread,
Jul 4, 2009, 8:46:01 AM7/4/09
to

Thank you Fred. I'm just getting familiar with VBA so this will be a
challenge. Really appreciate your help.
--
Sunrise

June7 via AccessMonster.com

unread,
Jul 4, 2009, 5:13:19 PM7/4/09
to
Thanks, I might have use for this.
Side note: re the dim statement. Only Y2 is declared as String, the others
are Variant. Must explicitely declare datatype for each variable even if on
same line else will be Variant.

fredg wrote:
>> I have a two-column report and would like to have one solid line between the
>> two columns.

>[quoted text clipped - 4 lines]


>>
>> Any ideas?
>
>Look up the Line Method in VBA help.
>
>Place the code below in the report's Page event.
>Note: you may have to adjust the length of the line below.
>
>Private Sub Report_Page()
>Dim X1, Y1, X2, Y2 As Single
>Me.DrawStyle = 0 ' a solid line
>
>Me.DrawWidth = 1 ' set the thickness of the line
>
>' Set the coordinates and draw a line down the middle of the page.
>
>X1 = Int(Me.ScaleWidth / 2) ' find the middle of the page
>Y1 = Me.Section(3).Height ' start just below the page header
>X2 = X1 ' the line is vertical
>
>' length of line is the length of the Page - (Height of the Page
>' Header + Height of the Page Footer).
>
>Y2 = Me.ScaleHeight - (Me.Section(1).Height + Me.Section(4).Height)
>
>Me.Line (X1, Y1)-(X2, Y2) ' This draws the line
>
>End Sub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200907/1

June7 via AccessMonster.com

unread,
Jul 4, 2009, 5:14:30 PM7/4/09
to
Sorry, typo I meant Single instead of String.

June7 wrote:
>Thanks, I might have use for this.
>Side note: re the dim statement. Only Y2 is declared as String, the others
>are Variant. Must explicitely declare datatype for each variable even if on
>same line else will be Variant.
>

>>> I have a two-column report and would like to have one solid line between the
>>> two columns.

>[quoted text clipped - 27 lines]

0 new messages