I am working on a report that will print out the Army hand recipt (DA Form 2062). The form itselt can consist of one page or multiple pages. The first page of the form has room for 16 lines of data, and each page after has room for 21 lines of data. In order for the form to be deemed "legal" for use, it has to be the whole form. So I will need the report to print with blanks lines of data based upon the number of items input by the user.
For instance if X:
16 > X add N blank records to equal 16
16 < X < 37 add N blank records to equal 37
37 < X < 58 add N blank records to equal 58
58 < X < 79 add N blank records to equal 79
so on and so forth.
My report is being populated from a table call OC. The table has two columns Equipment and Item.
I was provided the following code to use by MajP but cannot seem to get it to work and think I may be doing something wrong:
The code does not add any blank lines to the report when printed. I just can't figure it out. Should I be using a Query instead of the table to populated my form?
For instance if X:
16 > X add N blank records to equal 16
16 < X < 37 add N blank records to equal 37
37 < X < 58 add N blank records to equal 58
58 < X < 79 add N blank records to equal 79
so on and so forth.
My report is being populated from a table call OC. The table has two columns Equipment and Item.
I was provided the following code to use by MajP but cannot seem to get it to work and think I may be doing something wrong:
Code:
Public Function getnumberofBlanks() As Integer
Dim recordCount As Integer
Dim N As Integer
recordCount = DCount("*", Me.OC)
If recordCount <= 16 Then
getnumberofBlanks = 16 - recordCount
Else
N = 1
Do while N * 21 + 16 <= recordCount
N = N + 1
Loop
getnumberofBlanks = (N * 21 + 16) - recordCount
End If
End Function
Public Sub printBlankRecords(numberBlanks As Integer)
Dim recordCount As Integer
recordCount = DCount("*", Me.OC)
TotalCount = TotalCount + 1
If TotalCount = recordCount Then
Me.NextRecord = False
'once you get to the last record, stay on last record
ElseIf TotalCount > recordCount And TotalCount < (recordCount + numberBlanks) Then
Me.NextRecord = False
'make the font and backcolor the same appearing to be empty record
Me.Equipment.ForeColor = Me.Equipment.BackColor
Me.Item.ForeColor = Me.Item.BackColor
End If
End Sub Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
printBlankRecords getnumberofBlanks
End Sub
The code does not add any blank lines to the report when printed. I just can't figure it out. Should I be using a Query instead of the table to populated my form?