Option Compare Database
Option Explicit
Dim intLineNumber As Integer
Dim fShowLine As Boolean
Dim msg As Variant
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Err_Detail_OnFormat
Dim intTotalItems As Integer
Const conTotalLines = 16 ' Total number of lines Desired
intTotalItems = DCount("[itemID]", "reqItems Table", "[itemReqNumber]
= " & Me.poPRID)
If intLineNumber <= intTotalItems Then
With Me
.itemName.Properties("ForeColor") = 0
.itemAmtPerUnit.Properties("ForeColor") = 0
.itemUnitQty.Properties("ForeColor") = 0
.itemUnitCost.Properties("ForeColor") = 0
.itemTotalCost.Properties("ForeColor") = 0
.MoveLayout = True
If intLineNumber <> intTotalItems Then
.NextRecord = True
Else
.NextRecord = False
End If
.PrintSection = True
End With
intLineNumber = intLineNumber + 1
ElseIf intLineNumber <= conTotalLines Then
With Me
.itemName.Properties("ForeColor") = 16777215
.itemAmtPerUnit.Properties("ForeColor") = 16777215
.itemUnitQty.Properties("ForeColor") = 16777215
.itemUnitCost.Properties("ForeColor") = 16777215
.itemTotalCost.Properties("ForeColor") = 16777215
.MoveLayout = True
.NextRecord = False
.PrintSection = True
End With
intLineNumber = intLineNumber + 1
End If
Exit_Err_Detail_OnFormat:
Exit Sub
Err_Detail_OnFormat:
MsgBox Err.Description
Resume Exit_Err_Detail_OnFormat
End Sub
Private Sub Report_Open(Cancel As Integer)
' Initialize variables
fShowLine = True
intLineNumber = 1
End Sub
when the report is printed out, a single blank order line is
displayed, and none of the order lines that were retrieved are shown