Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serialising Report

Status
Not open for further replies.

hpicken

Technical User
Apr 12, 2001
142
AU
I'm using Access to print books and I would like to serialize (have a serial number) for each book printed.

20 books or so maybe printed at any one time.

I have two tables, one with the book details and the other with the records. The next serial number for that series of books would be stored in the book details table.

The serial number should print in the footer of each page
so I figure that an OnPrint event should be used.

I can't find anywhere if the OnPrint event is reset for each copy of a report that's printed or whether it applies for the whole time the report is open for that session.

I'm alright with the vba code required (I Think) just not where to include it.

TIA

Howard
 
Fixed it.

In case anyone comes across this problem again here's how.

I created a form to print the report from.
On this form I had a number of copies control.

When the print button is pressed the following vba
runs.

Dim intTmpCopy As Integer

If Not IsNull(Me!RegID) Then
While intTmpCopy <= Me!NumCopies
stDocName = &quot;rptPrint_Book&quot;
DoCmd.OpenReport stDocName, acNormal
DoCmd.SetWarnings False
DoCmd.RunSQL &quot;UPDATE tblRegisters SET tblRegisters.PrintRegNo = tblRegisters.PrintRegNo + 1 WHERE (([RegID]=[forms]![frmPrepareBook]![Regid]));&quot;
DoCmd.SetWarnings True
intTmpCopy = intTmpCopy + 1
Wend
Else
MsgBox &quot;Select a register to preview&quot;, vbOKOnly
End If

On the report in the footer is a dlookup to grab the info from tblRegisters.

It all works fairly quickly and serves the purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top