By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Problem with Report

P: n/a

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
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"
RowText = RowNum
End If
ObjectName = "Rand" & RowText & "-" & ElementNum
Me.Controls(ObjectName).Caption = rsRandom![RandomScore]
Next I
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?
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.