rudeboymcc
Registered User.
- Local time
- Today, 13:04
- Joined
- Sep 9, 2008
- Messages
- 69
Hi. I currently open my reports using collections so i can have multiple instances.
This works perfectly. The problem is when I try and print using file>print, (with teh print dialogue) I get the error:
"this action can't be carried out while processing a form or report event"
and then it proceeds to print just fine.
To find the problem, I deleted ALL the vba code behind my report, and I still get the error. The above code is the only thing that runs.
Wierd thing is, if I add a print button on the report, with only docmd.printout behind it, it works fine every time.
The other wierd part is if I use this button, then printing from file>print also works fine.
What could be causing this error? If I knew whre the code was I'd just put a "resume next" whenever it turns up but there is no code behind the report.
Code:
Option Compare Database
Option Explicit
'Author: Allen J Browne, July 2004
Public clnDS As New Collection
Function OpenADSReport()
'Purpose: Open an independent instance of form
Dim rpt As Report
On Error GoTo OpenAReport_Error
'Exit Function
'Open a new instance, show it, and set a caption.
Set rpt = New Report_rptDS
Set rpt = New Report_rptDS
rpt.Caption = [Forms]![DS]![Expr1]
clnDS.Add Item:=rpt, Key:=CStr(rpt.Hwnd)
rpt.Visible = True
Set rpt = Nothing
On Error GoTo 0
Exit Function
OpenAReport_Error:
Call ErrorLog(Err.Description, Err.Number, "mdlOpenAReport")
End Function
This works perfectly. The problem is when I try and print using file>print, (with teh print dialogue) I get the error:
"this action can't be carried out while processing a form or report event"
and then it proceeds to print just fine.
To find the problem, I deleted ALL the vba code behind my report, and I still get the error. The above code is the only thing that runs.
Wierd thing is, if I add a print button on the report, with only docmd.printout behind it, it works fine every time.
The other wierd part is if I use this button, then printing from file>print also works fine.
What could be causing this error? If I knew whre the code was I'd just put a "resume next" whenever it turns up but there is no code behind the report.