What you have should work, but the message is referring back to the method you used to open the report so the answer might lie in the DoCmd line you use to open the report. Can you post that?
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Function "PrintSelNameTags" is the action specified in a right-click popup menu.
Code:Private Function PrintSelNameTags() DoCmd.OpenReport "rptNameTags", acViewPreview End Function
You have no error trap for this (error 2501) in either place. Mind you, I think that it won't work in the report open code anyway because execution goes back to the initiating code when the report is opened (or canceled), so I'm pretty sure I've always put the error trap for this issue there. Try this
Code:Private Function PrintSelNameTags() On Error GoTo errHandler DoCmd.OpenReport "rptNameTags", acViewPreview errHandler: If Err.Number = 2501 Then Exit Function Else msgbox "Error " & Err.Number & ": " & Err.Description End If End Function
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Your suggestion of adding error handler code to the function cleared up the offending informational message. Never occurred to me to tackle the issue from the point-of-view of an error condition. My mindset was locked in on the notion that it was a proper method I was somehow missing.
Thanks,
Bill
Glad to have helped!