THANK YOU SO MUCH!
I was trying to do it Without selecting the [Event Procedure] first, and I would get the the "chose builder" box, in which the line in Expression Builder would NOT be accepted...
I'm sorry if this is all so elementary, but I'm REAL NEW at this stuff...
THANK YOU SO MUCH for your help! IT WORKS GREAT!
NOW... It looks like I should be able to NOT choose starting position and number of labels, but have it ALWAYS start at #1 and print #30 (I don't need the variables)...I'm not sure where I should make these changes.
Any ideas?
Sub ls_ReportOnOpen(rpt As Report, ByRef Cancel As Integer)
'Prompts user for a label printing start position, and a number of copies.
'Sets variables for the OnFormat event procedure to handle
Dim iStartLabel As Integer
Dim iCopies As Integer
Dim vResp As Variant
On Error GoTo ls_ReportOnOpen_err
'Prompt user for starting label position
vResp = InputBox("Start at which label?", "Label Saver", 1)
If vResp = "" Then
'Cancel was clicked
Cancel = True
GoTo ls_ReportOnOpen_exit
End If
iStartLabel = CInt(vResp)
'Validation check
If iStartLabel >= 1 And iStartLabel <= 400 Then
Else
MsgBox "Starting label must be between 1 and 400." & vbCrLf & vbCrLf & " Labels/Report cancelled"
Cancel = True
GoTo ls_ReportOnOpen_exit
End If
'Prompt user for number of copies
vResp = InputBox("How many copies of each label?", "Label Saver", 1)
If vResp = "" Then
'Cancel was clicked
Cancel = True
GoTo ls_ReportOnOpen_exit
End If
iCopies = CInt(vResp)
'Validation check
If iCopies < 1 Then
MsgBox "Number of copies must be greater than 0." & vbCrLf & vbCrLf & " Labels/Report cancelled"
Cancel = True
GoTo ls_ReportOnOpen_exit
Else
If iCopies >= 1 And iCopies <= 100 Then
Else
If MsgBox("Are you sure you want to print " & iCopies & " copies of each label?", vbYesNo, "Label Saver") = vbYes Then
Else
MsgBox "Labels/Report cancelled"
Cancel = True
GoTo ls_ReportOnOpen_exit
End If
End If
End If
'Set variables. These are used in the Report Detail OnFormat event procedure
iLSBlankRecordsToPrint = iStartLabel - 1
iLSCopiesToPrint = iCopies
ls_ReportOnOpen_exit:
Exit Sub
ls_ReportOnOpen_err:
MsgBox "Error in Label Saver subroutine ls_ReportOnOpen - " & Err & " - " & Err.Description
GoTo ls_ReportOnOpen_exit
End Sub
Sub ls_ReportOnPage()
'iLSBlankCount = 0
End Sub