Post the code you have behind the button please.
Post the code you have behind the button please.
I dropped the DoCmd.close and the DoCmd.OpenForm... code and it didn't make any difference, still got the error code.
Ron C
Is that the form that is *always* opened after the report?
I can say that was the behavior of Access 2007 and earlier. Don't see why it would be a version specific issue since, as I mentioned, the calling procedure is notifying that the action it was supposed to perform was cancelled. Nor is it restricted to the cancelling of a report event - applies to a forms and AFAIK, other cancellable events such as OutputTo. I would have thought it to be a universal feature. Too busy getting ready for a road trip to try it on 2016. Sorry.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Thanks Micron. I believe we are closing in on the problem.
No...stay on the thread. I just didn't want to impact your packing. We always appreciate your input.
Dialog mode halts the code that used it so that closing the report returns control to right after the OpenReport command.
Did we lose you Ron?
Yes, you're losing me; I'm don't understand your post regarding the return of control to right after the OpenReport command.
Okay...answer my post #18 and we may have more that one approach.
Answering my post #16 would be helpful as well.
Here is the code behind the button that opens and prints the report ( I have it in preview mode now)
Private Sub Command6_Click()
On Error GoTo Command6_Click_Err
'Preview a Report
DoCmd.OpenReport "appttblstaffdateselectedrpt", acViewPreview, "", "", acNormal 'previews report
'Print a Report
‘ DoCmd.OpenReport "appttblstaffdateselectedrpt", acViewNormal, "", "", acNormal 'prints report
Command6_Click_Exit:
Exit Sub
Command6_Click_Err:
MsgBox "An error has occurred. Please start over. ", vbOKOnly, ""
DoCmd.Close 'closes current form
DoCmd.OpenForm "appointmentschedulerfrm", acNormal, "", "", , acNormal 'opens form
Resume Command6_Click_Exit
End Sub
The form appointmentschedulerfrm is the one that is always open.