Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / October 2005

Tip: Looking for answers? Try searching our database.

Constant Number Of Lines On Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DataLady - 27 Oct 2005 22:51 GMT
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?
Signature

Sue A

Duane Hookom - 28 Oct 2005 03:59 GMT
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

Signature

Duane Hookom
MS Access MVP

>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
[quoted text clipped - 17 lines]
> are printed. I've tried everything I can think of to avoid this behavior
> without success. Can anyone help me?
DataLady - 28 Oct 2005 15:56 GMT
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
Signature

Sue A

> 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
[quoted text clipped - 37 lines]
> > are printed. I've tried everything I can think of to avoid this behavior
> > without success. Can anyone help me?
Duane Hookom - 28 Oct 2005 20:30 GMT
I don't care to reverse engineer their code. I would just use the code that
I know works.

Signature

Duane Hookom
MS Access MVP
--

> Duane:  Here are the functions (modified for my needs) that are being used
> in
[quoted text clipped - 88 lines]
>> > behavior
>> > without success. Can anyone help me?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.