If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
error message when previewing report from a command button
The preceding message didn't provide any information in response to my
question. Instead it included a link to a fee-based web site. So I'll repeat my original question in the hopes that someone may provide a response in this newsgroup: 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 |
#2
|
|||
|
|||
error message when previewing report from a command button
Paul James wrote:
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 In my limited experience with this error, it's either because I had something funky in the OnClick property instead of [Event Procedure] or because there was a compile error in the form's module. Try compiling your project to make sure there's nothing wrong in some part of the code. -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
error message when previewing report from a command button
Well, the project compiled, and now the problem has disappeared.
Thanks, Marsh |
#4
|
|||
|
|||
error message when previewing report from a command button
Paul James wrote:
Well, the project compiled, and now the problem has disappeared. Thanks, Marsh You're welcome, I guess. That's a little wierd, I would have expected it to find some kind of error, but if it works, let's not get too confused about it ;-\ -- Marsh MVP [MS Access] |
Thread Tools | |
Display Modes | |
|
|