the_utmost
Registered User.
- Local time
- Today, 12:28
- Joined
- Mar 10, 2005
- Messages
- 40
Hi:
I am printing reports off in code. The first one prints fine. When I loop through it the second time, I get a 2486 error "Cannot perform this action at this time." From what I have read on the Internet, Access maybe repainting the form and causing the error. Therefore I took out my DoEvents statement, but not luck. Here is my code. Any idea's?
For i = 1 To rsRunningReports.RecordCount
'* Print report
Set AccessApp = CreateObject("access.application")
If blnIsOpen = False Then
AccessApp.OpenCurrentDatabase (strPath)
blnIsOpen = True
End If
AccessApp.Visible = False
AccessApp.DoCmd.OpenReport rsRunningReports!report_name, acViewNormal, strWhereSQL '*** CRASHES HERE
DoEvents '* Allow report to be sent to the printer
DoCmd.Close acReport, rsRunningReports!report_name, acSaveNo
AccessApp.Quit
Set AccessApp = Nothing
Next i
I am printing reports off in code. The first one prints fine. When I loop through it the second time, I get a 2486 error "Cannot perform this action at this time." From what I have read on the Internet, Access maybe repainting the form and causing the error. Therefore I took out my DoEvents statement, but not luck. Here is my code. Any idea's?
For i = 1 To rsRunningReports.RecordCount
'* Print report
Set AccessApp = CreateObject("access.application")
If blnIsOpen = False Then
AccessApp.OpenCurrentDatabase (strPath)
blnIsOpen = True
End If
AccessApp.Visible = False
AccessApp.DoCmd.OpenReport rsRunningReports!report_name, acViewNormal, strWhereSQL '*** CRASHES HERE
DoEvents '* Allow report to be sent to the printer
DoCmd.Close acReport, rsRunningReports!report_name, acSaveNo
AccessApp.Quit
Set AccessApp = Nothing
Next i