Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vertical Line

Status
Not open for further replies.

Olifour

Technical User
Mar 6, 2002
12
0
0
FR
You will please find herewith below the codes on Visual BAsic for Access 2000.

I try to have vertical lines from the top of a detail section till the PageFooter.

I mean I succeed doing this only on controls of detail section but the vertical line does not go till the page footer (1) and in the other case, I succeed to go to the page footer but I can not avoid the vertical line on PageHeader or GroupLevel Header (2)

I'm not not an expert in programmation.

I would appreciate your free assistance.

Thks. Rgds. Olivier Fourmond.

(1)
Option Compare Database
Option Explicit

Sub someControl_AfterUpdate()
Me!SomeControl = UCase(Me!SomeControl)
' ou encore
' me!SomeControl = Lcase(me!SomeControl)
End Sub

Private Sub Détail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer

' This is the spacing between the right edge of the
' control and the Vertical Seperation Line
intLineMargin = 10

' OK lets draw a vertical line to seperate each field
' for each control in details control
' If your last control on the right does not end on the edge of the section
' you will get a second vertical line. If you need to get around this then you
' can skip drawing this last Vertical Seperation Line in a couple of ways.
' We'll use the control name method Here. Our right most control is named
' TestMemo. IF current control is TestMemo - Do not print Vertical Line
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
'If CtlDetail.name <> &quot;TestMemo&quot; Then
Me.Line ((.Left + .Width + intLineMargin), 0)-(.Left + .Width + _
intLineMargin, Me.Height)
'End If
End With
Next

'While we are here lets draw a box around the Detail section
With Me
Me.Line (0, 0)-Step(.Width, .Height), 0, B
End With

Set CtlDetail = Nothing

End Sub

Private Sub Report_Activate()
DoCmd.Maximize
End Sub

(2)
Option Compare Database
Option Explicit
' Stephen Lebans 1999
' Stephen@ lebans.com
'
Private Sub Report_Activate()
DoCmd.Maximize
End Sub


Private Sub Report_Page()
Const TWIPSPERINCH = 1440

' Offset from right edge of Control where our
' Vertical Line will start - adjust as you desire.
' Expressed in Twips
Dim intLineMargin As Integer

' Need Control object to loop through Control Collection
Dim CtlDetail As Control

' Y position where we will start Drawing our Grid from
Dim startY As Integer

' Var will be set to the Margin you
' set for the Bottom of the Page
' and Top of the Page via
' the Page Setup Menu
' Expressed in TWIPS.
Dim varBMargin As Variant
Dim varTMargin As Variant

'intLineMargin is expressed in TWIPS
intLineMargin = 20

' We need to draw a vertical line at the left and right
' edge of our report. All other vertical lines are to the
' right edge of the existing controls
' You should place the right most control at the extreme
' right edge of your report - intMargin
' Draw Line Left Edge
With Me
' Won't take 0 for the starting Y param - use 1.
Me.Line ((0), 1)-(0, .ScaleHeight - _
(.Section(acPageFooter).Height))

End With

' OK lets draw a vertical line to seperate each field
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
If Page = 1 Then
Me.Line ((.Left + .Width + intLineMargin), 1 + Me.Section(acHeader).Height) _
-(.Left + .Width + intLineMargin, Me.ScaleHeight - (Me.Section(acPageFooter).Height))
Else
Me.Line ((.Left + .Width + intLineMargin), 1) _
-(.Left + .Width + intLineMargin, Me.ScaleHeight - (Me.Section(acPageFooter).Height))
End If
End With
Next

'CleanUp time
Set CtlDetail = Nothing

End Sub
 
Why are going to so much trouble creating a vertical line. Create a rectangle with the two opposing vertical lines overlapping, eurika, a vertical line.

mac
 
Thks for this comment, but if I'm doing a rectangle, it follows the height of the control, and I need the line till the end of each page, whatever the size of the control... Effectively, this is not so easy. I need the advice of an expert...
 
He is asking how to make a (shape, if you will) transcend report sections. I've been wondering the same thing. &quot;Outside of a dog, a book is probably man's best friend; and inside a dog, it's too dark to read&quot; - G. Marx
 
Olifour, I did not mean my suggestion to be sarcastic. I was offering what I felt to be an alternative method. I apologize if you took it as a mean spirited post. Please be careful when you zap someone. Someone may have a solution; however, feel s\he is not &quot;expert&quot; enough to meet your needs.

mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top