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  

Multiple records per page



 
 
Thread Tools Display Modes
  #1  
Old November 16th, 2004, 09:10 PM
Aaron Hartley
external usenet poster
 
Posts: n/a
Default Multiple records per page

Hi,

I created a report in Access.

* The report has 4 labels per page. Label here means the report is
printed multiple times per page, not the label object type.
* Each label uses 75 numbers, records from a table that are used to
populate the caption property of 75 fields (label the object type).
The first label uses the first 75 records, the second label uses the
next 75 records and so on.

To accomplish I wrote some code for the report:

Dim rsRandom As Recordset
Dim CardTotal As Integer
Dim CardCurrent As Integer

Private Sub Report_Open(Cancel As Integer)
Dim D As Database
Set D = CurrentDb
Dim rsSize As Recordset
Set rsRandom = D.OpenRecordset("SELECT * FROM RandomScores;")
Set rsSize = D.OpenRecordset("SELECT * FROM RandomCount;")
CardTotal = rsSize![Count] \ 75
CardCurrent = 1
rsSize.Close
End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim I, RowNum, ElementNum As Integer
Dim ObjectName, RowText As String
If CardCurrent CardTotal Then
Me.NextRecord = False
For I = 0 To 74
RowNum = (I \ 15) + 1
ElementNum = (I + 1) Mod 15
If ElementNum = 0 Then
ElementNum = 15
End If
If RowNum = 5 Then
RowText = "TB"
Else
RowText = RowNum
End If
ObjectName = "Rand" & RowText & "-" & ElementNum
Me.Controls(ObjectName).Caption = rsRandom![RandomScore]
rsRandom.MoveNext
Next I
Else
Me.NextRecord = True
End If
CardCurrent = CardCurrent + 1
End Sub

To test the report I populated the RandomScores table with 1800
records. The RandomCount query simply returns the size of the
RandomScores table. 1800 records comes out to 24 labels occupying 6
pages. While six pages appear within the print preview, there are
four problems:

* The last two labels repeat themselves. They both use the exact same
75 records.
* The last 75 records in the RandomScores table are not being used.
The data the gets used twice is the second to last batch of 75.
* If I immediately print out the report upon opening it, I get pages 2
through 6.
* If I page through the report and then print it out, I only 1 label,
the last one.

Does anyone have suggestions?
 




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
Cannot view multiple records in Form view Heather Using Forms 5 August 12th, 2004 07:59 PM
Headers and Footers Pat Jennings Page Layout 9 July 29th, 2004 07:39 PM
Report prints additional page with no records Nelson Setting Up & Running Reports 1 June 30th, 2004 09:04 PM
Omit Page # on first page JethroUK© New Users 16 June 17th, 2004 09:20 PM
NUMBERING the pages Bob New Users 7 June 14th, 2004 12:20 AM


All times are GMT +1. The time now is 08:36 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.