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 <> "TestMemo" 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
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 <> "TestMemo" 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