P
Paul James
I've got a report that I'm trying to preview from a command button in a
form. However, when I click the button, I get the following error message:
"The expression On Click you entered as the event property setting produced
the following error: A problem occurred while Microsoft Access was
communicating with the OLE server or ActiveX Control.
* The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro."
I can open the report directly by double clicking on it in the database
window, and I'm able to open other reports with command buttons on forms, so
I don't think I'm missing a necessary Object Library. For some reason,
however, I get this error message opening this particular report from
command button. I've also recreated the button with the Command button
Wizard in form design view, and still get the error message with the new
button.
The click event for the command button is as follows:
Private Sub cmdPreviewDenialReport_Click()
On Error GoTo Err_cmdPreviewDenialReport_Click
Dim stDocName As String
stDocName = "rptDenialReport"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPreviewDenialReport_Click:
Exit Sub
Err_cmdPreviewDenialReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewDenialReport_Click
End Sub
Can anyone tell me how to overcome this problem?
Thanks in advance,
Paul
form. However, when I click the button, I get the following error message:
"The expression On Click you entered as the event property setting produced
the following error: A problem occurred while Microsoft Access was
communicating with the OLE server or ActiveX Control.
* The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro."
I can open the report directly by double clicking on it in the database
window, and I'm able to open other reports with command buttons on forms, so
I don't think I'm missing a necessary Object Library. For some reason,
however, I get this error message opening this particular report from
command button. I've also recreated the button with the Command button
Wizard in form design view, and still get the error message with the new
button.
The click event for the command button is as follows:
Private Sub cmdPreviewDenialReport_Click()
On Error GoTo Err_cmdPreviewDenialReport_Click
Dim stDocName As String
stDocName = "rptDenialReport"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPreviewDenialReport_Click:
Exit Sub
Err_cmdPreviewDenialReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewDenialReport_Click
End Sub
Can anyone tell me how to overcome this problem?
Thanks in advance,
Paul