I have searched for an answer to this question without any sucess, so any help would be appreciated.
I have a report that is linked to a command button on a form. I have the following VBA code on the button:
Private Sub cboRMAComplete_Click()
DoCmd.Close
DoCmd.OpenReport "RMA Label", acViewPreview
DoCmd.RunCommand acCmdPrint
End Sub
All this works, it brings up a blank preview of the report (not an issue as I don't care whether the users even see the preview or not), the Print Dialog box is opened over the preview. It allows me to select a specific printer and prints the report correctly. All good so far.
Now the problem: Once you select the printer and print the report, the print dialog box closes, and a preview of the report appears in the report window. The only way to close the report window is by clicking on the X on the window. What I need to do is get the report window to close programmatically as some of the users of this application are frankly not competent enough to be trusted to click an X to close the window. I have code also that runs on the close report event that is necessary to the operation of the database as well, which is why I do not want to leave it to chance as far as closing the window.
Any ideas?
I have a report that is linked to a command button on a form. I have the following VBA code on the button:
Private Sub cboRMAComplete_Click()
DoCmd.Close
DoCmd.OpenReport "RMA Label", acViewPreview
DoCmd.RunCommand acCmdPrint
End Sub
All this works, it brings up a blank preview of the report (not an issue as I don't care whether the users even see the preview or not), the Print Dialog box is opened over the preview. It allows me to select a specific printer and prints the report correctly. All good so far.
Now the problem: Once you select the printer and print the report, the print dialog box closes, and a preview of the report appears in the report window. The only way to close the report window is by clicking on the X on the window. What I need to do is get the report window to close programmatically as some of the users of this application are frankly not competent enough to be trusted to click an X to close the window. I have code also that runs on the close report event that is necessary to the operation of the database as well, which is why I do not want to leave it to chance as far as closing the window.
Any ideas?