Blank records in a Report

  • Thread starter Thread starter TomL
  • Start date Start date
T

TomL

How can I add a blank record to a report? I want to fill
the page of the report even if there are not enough
records to do the job...for instance the report will hold
20 records, but I only have 12 records with data, how can
I add 2 blank record lines. (example, a shipping document
where I want to be able to pen and ink data at a later
time)

Thanks
 
TomL said:
How can I add a blank record to a report? I want to fill
the page of the report even if there are not enough
records to do the job...for instance the report will hold
20 records, but I only have 12 records with data, how can
I add 2 blank record lines. (example, a shipping document
where I want to be able to pen and ink data at a later
time)


This can get tricky and it depends on what else you have
going on in your report. For a simple report, this should
be adequate.

The first thing you need is to add a text box named
txtLineCount in the detail section. Set its control source
expression to =1 and RunningSum property to Over All. This
allows you to use code that does something different for
different details.

The next thing is to add a text box named txtTotalLines to
the report header section, set its control source expression
to =Count(*). This allows you to identify the last detail.

Now you can use code like this:

Const LinesPerPage As Integer = 20

Dim intExtra As Integer

Private Sub ReportHeader_Format(Cancel As Integer, _
FormatCount As Integer)
intExtra = 0
End Sub

Private Sub Detail_Format(Cancel As Integer, _
FormatCount As Integer)
If (Me.txtLineCount >= Me.txtTotalLines) _
And ((Me.txtLineCount + intExtra) _
Mod LinesPerPage <> 0) Then
' Done with regular data lines.
If intExtra = 1 Then
' Make data controls invisible
Me.somecontrol.Visible = False
Me.anothercontrol.Visible = False
' . . .
End If
intExtra = intExtra + 1
Me.NextRecord = False
End If
End Sub

It takes a little more code than that if your report has
Grouping, but since you didn't mention it, I won't go into
that now.
 
Thanks!

Fixed a problem I've had for a long while with different
DB's.
You've been a great help, thanks again

Tom
 
Back
Top