A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Constant Number Of Lines On Report



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2005, 10:51 PM
DataLady
external usenet poster
 
Posts: n/a
Default Constant Number Of Lines On Report

I am using code provided by Microsoft on how to print a constant number of
lines on a report. I use it for forms where the printed form has to have x
number of blank lines (the lines are really boxes and they print -- think of
most any form you've seen that has lines for multiple entries). My database
fills in those lines where there is data, and then prints the remaining
number of lines to fill the page. My problem is that the code works fine as
long as the number of used lines is 2 less than the maximum allowable on the
page. If the number of records is one or two less than the maximum, the last
record prints twice. For example, I have a form with 15 lines on it. If there
are 10 records, each one prints just fine (no duplicates) with 5 lines below.
If there are 14 or 15 records, the last one prints twice and no blank lines
are printed. I've tried everything I can think of to avoid this behavior
without success. Can anyone help me?
--
Sue A
  #2  
Old October 28th, 2005, 03:59 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default Constant Number Of Lines On Report

I don't know how MS suggests you make the lines. The solution I use is to
draw the lines with code in the On Page event of the report. This code draws
24 lines regardless of the number of records on the page.

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
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

--
Duane Hookom
MS Access MVP


"DataLady" wrote in message
...
I am using code provided by Microsoft on how to print a constant number of
lines on a report. I use it for forms where the printed form has to have x
number of blank lines (the lines are really boxes and they print -- think
of
most any form you've seen that has lines for multiple entries). My
database
fills in those lines where there is data, and then prints the remaining
number of lines to fill the page. My problem is that the code works fine
as
long as the number of used lines is 2 less than the maximum allowable on
the
page. If the number of records is one or two less than the maximum, the
last
record prints twice. For example, I have a form with 15 lines on it. If
there
are 10 records, each one prints just fine (no duplicates) with 5 lines
below.
If there are 14 or 15 records, the last one prints twice and no blank
lines
are printed. I've tried everything I can think of to avoid this behavior
without success. Can anyone help me?
--
Sue A



  #3  
Old October 28th, 2005, 03:56 PM
DataLady
external usenet poster
 
Posts: n/a
Default Constant Number Of Lines On Report

Duane: Here are the functions (modified for my needs) that are being used in
the OnPrint event of the Group Header and Detail sections respectively. I was
able to use the code you supplied successfully, except that I had to modify
the top margin value to make the lines start printing lower on the page, as
there is a page header and a group header section that shouldn't have the
lines. As long as I have something that works, I'm happy, except that I have
several applications where I need the ability to control the number of lines
within sections of a report and it would be nice if the functions below could
be make to work reliably without duplicating the last record when the total
count of the records is equal to the TotGrp value.

Public Function SetCount(R As Report)
TotCount = 0
R![Destination].Visible = True
R![EventDate].Visible = True
R![PickUpTime].Visible = True
R![DropOffTime].Visible = True
R![NumStudents].Visible = True
R![NumBuses].Visible = True
End Function

Public Function PrintLines(R As Report, TotGrp)
TotCount = TotCount + 1
If TotCount = TotGrp Then
R.NextRecord = False
ElseIf TotCount TotGrp And TotCount 14 Then
R.NextRecord = False
R![Destination].Visible = False
R![EventDate].Visible = False
R![PickUpTime].Visible = False
R![DropOffTime].Visible = False
R![NumStudents].Visible = False
R![NumBuses].Visible = False
End If
End Function
--
Sue A


"Duane Hookom" wrote:

I don't know how MS suggests you make the lines. The solution I use is to
draw the lines with code in the On Page event of the report. This code draws
24 lines regardless of the number of records on the page.

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
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

--
Duane Hookom
MS Access MVP


"DataLady" wrote in message
...
I am using code provided by Microsoft on how to print a constant number of
lines on a report. I use it for forms where the printed form has to have x
number of blank lines (the lines are really boxes and they print -- think
of
most any form you've seen that has lines for multiple entries). My
database
fills in those lines where there is data, and then prints the remaining
number of lines to fill the page. My problem is that the code works fine
as
long as the number of used lines is 2 less than the maximum allowable on
the
page. If the number of records is one or two less than the maximum, the
last
record prints twice. For example, I have a form with 15 lines on it. If
there
are 10 records, each one prints just fine (no duplicates) with 5 lines
below.
If there are 14 or 15 records, the last one prints twice and no blank
lines
are printed. I've tried everything I can think of to avoid this behavior
without success. Can anyone help me?
--
Sue A




  #4  
Old October 28th, 2005, 08:30 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default Constant Number Of Lines On Report

I don't care to reverse engineer their code. I would just use the code that
I know works.

--
Duane Hookom
MS Access MVP
--

"DataLady" wrote in message
...
Duane: Here are the functions (modified for my needs) that are being used
in
the OnPrint event of the Group Header and Detail sections respectively. I
was
able to use the code you supplied successfully, except that I had to
modify
the top margin value to make the lines start printing lower on the page,
as
there is a page header and a group header section that shouldn't have the
lines. As long as I have something that works, I'm happy, except that I
have
several applications where I need the ability to control the number of
lines
within sections of a report and it would be nice if the functions below
could
be make to work reliably without duplicating the last record when the
total
count of the records is equal to the TotGrp value.

Public Function SetCount(R As Report)
TotCount = 0
R![Destination].Visible = True
R![EventDate].Visible = True
R![PickUpTime].Visible = True
R![DropOffTime].Visible = True
R![NumStudents].Visible = True
R![NumBuses].Visible = True
End Function

Public Function PrintLines(R As Report, TotGrp)
TotCount = TotCount + 1
If TotCount = TotGrp Then
R.NextRecord = False
ElseIf TotCount TotGrp And TotCount 14 Then
R.NextRecord = False
R![Destination].Visible = False
R![EventDate].Visible = False
R![PickUpTime].Visible = False
R![DropOffTime].Visible = False
R![NumStudents].Visible = False
R![NumBuses].Visible = False
End If
End Function
--
Sue A


"Duane Hookom" wrote:

I don't know how MS suggests you make the lines. The solution I use is to
draw the lines with code in the On Page event of the report. This code
draws
24 lines regardless of the number of records on the page.

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
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

--
Duane Hookom
MS Access MVP


"DataLady" wrote in message
...
I am using code provided by Microsoft on how to print a constant number
of
lines on a report. I use it for forms where the printed form has to
have x
number of blank lines (the lines are really boxes and they print --
think
of
most any form you've seen that has lines for multiple entries). My
database
fills in those lines where there is data, and then prints the remaining
number of lines to fill the page. My problem is that the code works
fine
as
long as the number of used lines is 2 less than the maximum allowable
on
the
page. If the number of records is one or two less than the maximum, the
last
record prints twice. For example, I have a form with 15 lines on it. If
there
are 10 records, each one prints just fine (no duplicates) with 5 lines
below.
If there are 14 or 15 records, the last one prints twice and no blank
lines
are printed. I've tried everything I can think of to avoid this
behavior
without success. Can anyone help me?
--
Sue A






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anyone seen this behaviour? What might it be? tw General Discussion 4 June 30th, 2005 03:23 PM
To Sharkbyte and all: Calculate a total values in group level Ally General Discussion 6 June 13th, 2005 08:16 PM
Problem printing blank lines on a report Carl Rapson Setting Up & Running Reports 2 May 16th, 2005 05:15 PM
Number of objects thomak General Discussion 3 February 17th, 2005 11:58 AM
Adding sequential number to a report ? TonyB New Users 0 May 3rd, 2004 02:14 PM


All times are GMT +1. The time now is 08:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.