Hi all,
I have a working database with a form that allows the user to enter some info in.
I have a report that has two unbounded fields (PrintPart1 and PrintSerial1, Report name is BlankSerialReport)
On the form I have a button used to open the report
My problem is setting up the BlankSerialReport button
When clicked I want the button to print a number of BlankSerialReport's, all that have the same PrintPart1 field value and incrementing PrintSerial1 field values.
So on my form I added three unbounded fields:
Part --> To enter the PrintPart1 value
FirstSerial --> To enter the starting PrintSerial1 value
NumberBlanks --> To enter the number of BlankSerialReport's to be printed
My event procedure for On Click
Code:
Private Sub Print_Blank_Reports_with_Serial_Number_Click()
On Error GoTo Err_Print_Blank_Reports_with_Serial_Number_Click
Dim stDocName As String
Dim i As Integer
Dim printSerialNumber As Integer
stDocName = "BlankSerialReport"
printSerialNumber = Me![FirstSerial]
For i = 1 To Me![NumberBlanks]
Reports!BlankSerialReport.Controls!PrintPart1 = Me!Part
Reports!BlankSerialReport.Controls!PrintSerial1 = printSerialNumber
DoCmd.OpenReport stDocName, acViewNormal
printSerialNumber = printSerialNumber + 1
Next
Exit_Print_Blank_Reports_with_Serial_Num:
Exit Sub
Err_Print_Blank_Reports_with_Serial_Number_Click:
MsgBox Err.Description
Resume Exit_Print_Blank_Reports_with_Serial_Num
End Sub
The above code does not work, I keep getting "The report name 'BlankSerialReport' you entered is misspelled or refers to a report that isn't open or doesn't exist".
I believe the problem is this code:
Reports!BlankSerialReport.Controls!PrintPart1 = Me!Part
Reports!BlankSerialReport.Controls!PrintSerial1 = printSerialNumber
What is the correct way to set an unbounded field in a report before you open the report?