访问报告打印输出(或 PDF)缺少打印预览中可见的信息
Access report printout (or PDF) is missing information visible on print preview
我将 VBA 添加到我的报告中以在发票中包含空白行,从 here 获得此代码。打印预览向我显示了我想要的空白行,但是当我想将其导出为 PDF 或打印报告时,它向我显示了不可见的文本(而不是仅在空白行中)。我编辑了原始代码以重置增量编号,但这仅在从报告视图切换到打印预览时有效(问题也出在这里,我认为在打印或导出时它也会重新查询报告,因此问题将得到解决, 但无济于事)。
这是给我空白行的代码:
Option Compare Database
Option Explicit
Const iLines As Integer = 15
Private iTotal As Integer
' code added to make count able to reset on report load
Private iLine As Integer
Private Sub Report_Open(Cancel As Integer)
' get total record count
iTotal = DCount("*", "OrderLine", "fkOrderID = " & TempVars!tempOrderID)
' code added to reset count
iLine = 0
End Sub
Private Sub Details_Format(Cancel As Integer, _
FormatCount As Integer)
' code added to reset visibility
Me!Item.Visible = True
Me!qty.Visible = True
Me!CalcPrijs.Visible = True
Me!TotPrijs.Visible = True
' increment iLine on each detail format
iLine = iLine + 1
If iLine < iTotal Then
' do nothing ... print as usual
ElseIf iLine = iTotal Then
' if there are more lines to print, set the
' NextRecord property to false, preventing
' the report from exiting prematurely
If iLine < iLines Then Me.NextRecord = False
Else
' changed this to make text invisible instead of white
Me!Item.Visible = False
Me!qty.Visible = False
Me!CalcPrijs.Visible = False
Me!TotPrijs.Visible = False
' prevent report from advancing past last row
' until all of blank lines has have printed
If iLine < iLines Then Me.NextRecord = False
End If
End Sub
我是不是漏掉了什么?我希望一个漂亮的打印预览能给我一个漂亮的打印输出。有没有办法在不丢失打印输出数据的情况下获取额外的空白行?我添加了几张图片来说明我想要什么。
打印预览
PDF输出
找到解决方案。必须调用 pageHeaderSection_Print
子
在为打印设置报表格式时重置 iLine 变量,现在一切正常。
我将 VBA 添加到我的报告中以在发票中包含空白行,从 here 获得此代码。打印预览向我显示了我想要的空白行,但是当我想将其导出为 PDF 或打印报告时,它向我显示了不可见的文本(而不是仅在空白行中)。我编辑了原始代码以重置增量编号,但这仅在从报告视图切换到打印预览时有效(问题也出在这里,我认为在打印或导出时它也会重新查询报告,因此问题将得到解决, 但无济于事)。
这是给我空白行的代码:
Option Compare Database
Option Explicit
Const iLines As Integer = 15
Private iTotal As Integer
' code added to make count able to reset on report load
Private iLine As Integer
Private Sub Report_Open(Cancel As Integer)
' get total record count
iTotal = DCount("*", "OrderLine", "fkOrderID = " & TempVars!tempOrderID)
' code added to reset count
iLine = 0
End Sub
Private Sub Details_Format(Cancel As Integer, _
FormatCount As Integer)
' code added to reset visibility
Me!Item.Visible = True
Me!qty.Visible = True
Me!CalcPrijs.Visible = True
Me!TotPrijs.Visible = True
' increment iLine on each detail format
iLine = iLine + 1
If iLine < iTotal Then
' do nothing ... print as usual
ElseIf iLine = iTotal Then
' if there are more lines to print, set the
' NextRecord property to false, preventing
' the report from exiting prematurely
If iLine < iLines Then Me.NextRecord = False
Else
' changed this to make text invisible instead of white
Me!Item.Visible = False
Me!qty.Visible = False
Me!CalcPrijs.Visible = False
Me!TotPrijs.Visible = False
' prevent report from advancing past last row
' until all of blank lines has have printed
If iLine < iLines Then Me.NextRecord = False
End If
End Sub
我是不是漏掉了什么?我希望一个漂亮的打印预览能给我一个漂亮的打印输出。有没有办法在不丢失打印输出数据的情况下获取额外的空白行?我添加了几张图片来说明我想要什么。
打印预览
PDF输出
找到解决方案。必须调用 pageHeaderSection_Print
子
在为打印设置报表格式时重置 iLine 变量,现在一切正常。