A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

error message when previewing report from a command button



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2004, 05:02 PM
Paul James
external usenet poster
 
Posts: n/a
Default 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  
Old May 19th, 2004, 06:57 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default 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  
Old May 19th, 2004, 11:36 PM
Paul James
external usenet poster
 
Posts: n/a
Default error message when previewing report from a command button

Well, the project compiled, and now the problem has disappeared.

Thanks, Marsh


  #4  
Old May 20th, 2004, 12:53 AM
Marshall Barton
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.