L
Lachlan Sharp
I am using the Detail Sections OnPrint Event to shade
every alternative record using the Line method. I have
included the code I am using:
' ** Access 2000 ********************
Option Compare Database
Option Explicit
Dim Odd As Boolean
Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Color As Long
If PrintCount = 1 Then ' Only toggle the shading for a
new record
Odd = Not Odd ' Toogle boolean value
End If
' Specify unit of measurement for coordinates on a
page...
Me.ScaleMode = 3 ' reports width and height
dimensions are returned in twips
' Set upper left corner of rectangle
X1 = 0
Y1 = 0
' Set rectangle to print the width and height of the
details section
X2 = Me.Width
Y2 = Me.Section(0).Height
Me.DrawWidth = 1 ' Width of the line (in pixels).
Color = 10079487
' Draw the line with the Line method.
If Odd Then
Me.Line (X1, Y1)-(X2, Y2), Color, BF
End If
End Sub
' ********************************
This code has worked well for me except under certain
circumstances where the height of the rectangle drawn is
less than the height of the details section. One
circumstance is if a texbox is 'significantly' too narrow
for the text to be displayed and hence has to grow
greatly. I can't define significantly, but there is a
point beyond which the text box can be undersized in
design view that the rectangle drawn is no longer the
correct height. Up to that point the code works fine.
The other circumstance has been where I've used a very
small font size (Arial font, 4 points) and the rectangle
drawn is always the height of the details section in
design view, not the height of the details section as it's
printed.
What is causing the anomaly with the Detail Section height
being returned, how can I change my code to work around it?
I am under the understanding that if I make the height,
using the line method, 22 inches (which is the max) then
it will automatically be fitted to the height of the
details section. However because I'm using twips as my
measurment system I'm not sure what the maximum height
would be. It also does not seem a very elgant way of
solving the problem. I am also using the line method to
draw grids around report data (elsewhere) hence my desire
to use twips to properly identify the location of controls
using their top/left/width/height properties.
Thanks
Lachlan Sharp
every alternative record using the Line method. I have
included the code I am using:
' ** Access 2000 ********************
Option Compare Database
Option Explicit
Dim Odd As Boolean
Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Color As Long
If PrintCount = 1 Then ' Only toggle the shading for a
new record
Odd = Not Odd ' Toogle boolean value
End If
' Specify unit of measurement for coordinates on a
page...
Me.ScaleMode = 3 ' reports width and height
dimensions are returned in twips
' Set upper left corner of rectangle
X1 = 0
Y1 = 0
' Set rectangle to print the width and height of the
details section
X2 = Me.Width
Y2 = Me.Section(0).Height
Me.DrawWidth = 1 ' Width of the line (in pixels).
Color = 10079487
' Draw the line with the Line method.
If Odd Then
Me.Line (X1, Y1)-(X2, Y2), Color, BF
End If
End Sub
' ********************************
This code has worked well for me except under certain
circumstances where the height of the rectangle drawn is
less than the height of the details section. One
circumstance is if a texbox is 'significantly' too narrow
for the text to be displayed and hence has to grow
greatly. I can't define significantly, but there is a
point beyond which the text box can be undersized in
design view that the rectangle drawn is no longer the
correct height. Up to that point the code works fine.
The other circumstance has been where I've used a very
small font size (Arial font, 4 points) and the rectangle
drawn is always the height of the details section in
design view, not the height of the details section as it's
printed.
What is causing the anomaly with the Detail Section height
being returned, how can I change my code to work around it?
I am under the understanding that if I make the height,
using the line method, 22 inches (which is the max) then
it will automatically be fitted to the height of the
details section. However because I'm using twips as my
measurment system I'm not sure what the maximum height
would be. It also does not seem a very elgant way of
solving the problem. I am also using the line method to
draw grids around report data (elsewhere) hence my desire
to use twips to properly identify the location of controls
using their top/left/width/height properties.
Thanks
Lachlan Sharp