Problem printing blank lines on a report

C

Carl Rapson

I'm trying to print some blank lines following my detail section, which
seems to be a fairly common problem. The idea is to emulate a printed form,
which has a fixed number of lines for the "detail" section (in this case,
it's something like an invoice form). My report is based on a query of the
line items, so that's what is in the Detail section of the report. The
invoice number and associated invoice-level fields are in a Group header.

I looked around in this newsgroup, and came up with the following code which
is supposed to print blank lines:

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
Dim intDetailHeight As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.fontsize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

This does indeed print blank lines, but the lines begin at the top of the
report instead of following the Detail section. How can I print a variable
number of blank lines following my Detail section to fill up the page?

Thanks for any assistance,

Carl Rapson
 
M

Marshall Barton

Carl said:
I'm trying to print some blank lines following my detail section, which
seems to be a fairly common problem. The idea is to emulate a printed form,
which has a fixed number of lines for the "detail" section (in this case,
it's something like an invoice form). My report is based on a query of the
line items, so that's what is in the Detail section of the report. The
invoice number and associated invoice-level fields are in a Group header.

I looked around in this newsgroup, and came up with the following code which
is supposed to print blank lines:

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
Dim intDetailHeight As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
Me.fontsize = 16
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

This does indeed print blank lines, but the lines begin at the top of the
report instead of following the Detail section. How can I print a variable
number of blank lines following my Detail section to fill up the page?


You need to add a module level variable to save the position
of the last detail section. Then use the detail section's
Print event to set the variable:

mlngLastPos = Me.Top 'obscure but useful feature

You can then use that value in the Page event to establish
the position of the first line.
 
C

Carl Rapson

Marshall Barton said:
You need to add a module level variable to save the position
of the last detail section. Then use the detail section's
Print event to set the variable:

mlngLastPos = Me.Top 'obscure but useful feature

You can then use that value in the Page event to establish
the position of the first line.

Thanks, Marshall.

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top