N
notbitmonk
I have a procedure attached to the format event of the detail section of a report. The code works great. I can see the report with the layout that I want (code in the format events takes care of positioning field boxes and creating a "scaled" report"). Problem is that when I send the report to print, the printout does not has any of the format that I see on the screen (I print it to a Lexmark X1550 and to PDF). The formatting is lost even if I export to snapshot. If you look at the code you will see that is divided in two sections. The first section positions the fields at the top of the detail section. This is done because Access wil "remember" the last height of the section and continue using it until a larger height is provided, it doesnt matter that the code is giving instructions to make the section smaller. If the first part of the code is not included, the report will come out "half-scaled", meaning that it will make the section bigger and not smaller. Also, when the report is printed, I start getting error the the control is too big for the section but I dont see any extra space and the report will print. If I try attaching the code to print event, I just get a bunch of errors because properties are not available at Print time. Thank for any help. Here is the code
Option Compare Databas
Option Explici
Dim intDepth As Intege
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer
'Scales detail section to fit boring lo
On Error GoTo ErrorHandle
If IsNull(intDepth) The
intDepth =
End I
'Position controls at the top to prevent misplacemen
DepthTop.Top =
DepthBottom.Top =
USCS.Top =
Description.Top =
SampleSelected.Top =
GWObserved.Top =
timeHour.Top =
sngResults.Top =
sngRecovery.Top =
Detail.Height = 30
Line41.Height = 30
Line42.Height = 30
If (Nz(DepthBottom) - intDepth) > 1 The
Detail.Height = (DepthBottom - intDepth) * 30
intDepth = DepthBotto
DepthTop.Top =
DepthBottom.Top = Detail.Height - 30
USCS.Top = Detail.Height - 30
Description.Top = Detail.Height - 30
SampleSelected.Top = Detail.Height - 30
GWObserved.Top = Detail.Height - 30
timeHour.Top = Detail.Height - 30
sngResults.Top = Detail.Height - 30
sngRecovery.Top = Detail.Height - 30
Line41.Height = Detail.Heigh
Line42.Height = Detail.Heigh
End I
ExitHandler
Exit Su
ErrorHandler
MsgBox "Error: " & Err.Number & vbNewLine
& "Description: " & Err.Description, vbMsgBoxHelpButton, "Error durin
format", Err.HelpFile, Err.HelpContex
GoTo ExitHandle
End Su
Option Compare Databas
Option Explici
Dim intDepth As Intege
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer
'Scales detail section to fit boring lo
On Error GoTo ErrorHandle
If IsNull(intDepth) The
intDepth =
End I
'Position controls at the top to prevent misplacemen
DepthTop.Top =
DepthBottom.Top =
USCS.Top =
Description.Top =
SampleSelected.Top =
GWObserved.Top =
timeHour.Top =
sngResults.Top =
sngRecovery.Top =
Detail.Height = 30
Line41.Height = 30
Line42.Height = 30
If (Nz(DepthBottom) - intDepth) > 1 The
Detail.Height = (DepthBottom - intDepth) * 30
intDepth = DepthBotto
DepthTop.Top =
DepthBottom.Top = Detail.Height - 30
USCS.Top = Detail.Height - 30
Description.Top = Detail.Height - 30
SampleSelected.Top = Detail.Height - 30
GWObserved.Top = Detail.Height - 30
timeHour.Top = Detail.Height - 30
sngResults.Top = Detail.Height - 30
sngRecovery.Top = Detail.Height - 30
Line41.Height = Detail.Heigh
Line42.Height = Detail.Heigh
End I
ExitHandler
Exit Su
ErrorHandler
MsgBox "Error: " & Err.Number & vbNewLine
& "Description: " & Err.Description, vbMsgBoxHelpButton, "Error durin
format", Err.HelpFile, Err.HelpContex
GoTo ExitHandle
End Su