J
Jesse Aviles
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 sent 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). 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 Database
Option Explicit
Dim intDepth As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Scales detail section to fit boring log
On Error GoTo ErrorHandler
If IsNull(intDepth) Then
intDepth = 0
End If
'Position controls at the top to prevent misplacement
DepthTop.Top = 0
DepthBottom.Top = 0
USCS.Top = 0
Description.Top = 0
SampleSelected.Top = 0
GWObserved.Top = 0
timeHour.Top = 0
sngResults.Top = 0
sngRecovery.Top = 0
Detail.Height = 300
Line41.Height = 300
Line42.Height = 300
If (Nz(DepthBottom) - intDepth) > 1 Then
Detail.Height = (DepthBottom - intDepth) * 300
intDepth = DepthBottom
DepthTop.Top = 0
DepthBottom.Top = Detail.Height - 300
USCS.Top = Detail.Height - 300
Description.Top = Detail.Height - 300
SampleSelected.Top = Detail.Height - 300
GWObserved.Top = Detail.Height - 300
timeHour.Top = Detail.Height - 300
sngResults.Top = Detail.Height - 300
sngRecovery.Top = Detail.Height - 300
Line41.Height = Detail.Height
Line42.Height = Detail.Height
End If
ExitHandler:
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & vbNewLine _
& "Description: " & Err.Description, vbMsgBoxHelpButton, "Error during
format", Err.HelpFile, Err.HelpContext
GoTo ExitHandler
End Sub
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 sent 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). 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 Database
Option Explicit
Dim intDepth As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Scales detail section to fit boring log
On Error GoTo ErrorHandler
If IsNull(intDepth) Then
intDepth = 0
End If
'Position controls at the top to prevent misplacement
DepthTop.Top = 0
DepthBottom.Top = 0
USCS.Top = 0
Description.Top = 0
SampleSelected.Top = 0
GWObserved.Top = 0
timeHour.Top = 0
sngResults.Top = 0
sngRecovery.Top = 0
Detail.Height = 300
Line41.Height = 300
Line42.Height = 300
If (Nz(DepthBottom) - intDepth) > 1 Then
Detail.Height = (DepthBottom - intDepth) * 300
intDepth = DepthBottom
DepthTop.Top = 0
DepthBottom.Top = Detail.Height - 300
USCS.Top = Detail.Height - 300
Description.Top = Detail.Height - 300
SampleSelected.Top = Detail.Height - 300
GWObserved.Top = Detail.Height - 300
timeHour.Top = Detail.Height - 300
sngResults.Top = Detail.Height - 300
sngRecovery.Top = Detail.Height - 300
Line41.Height = Detail.Height
Line42.Height = Detail.Height
End If
ExitHandler:
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & vbNewLine _
& "Description: " & Err.Description, vbMsgBoxHelpButton, "Error during
format", Err.HelpFile, Err.HelpContext
GoTo ExitHandler
End Sub