Vertical line between columns, full page length

S

Sunrise

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?
 
F

fredg

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?

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
 
S

Sunrise

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

June7 via AccessMonster.com

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 - 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
 
J

June7 via AccessMonster.com

Sorry, typo I meant Single instead of String.
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.
[quoted text clipped - 27 lines]
 

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