S
sebair
I am writing a windows service in VB.Net 2008 to run on Win Server 2003.
Here is my code.
Public Sub PrintReport()
Dim acc As New Access.Application
Try
acc.OpenCurrentDatabase(My.Settings.dbLocation)
acc.DoCmd.OpenReport(_name, Access.AcView.acViewNormal, ,
_filter, Access.AcWindowMode.acHidden)
Catch ex As Exception
Throw ex
Finally
acc.CloseCurrentDatabase()
acc.Quit()
End Try
End Sub
The code errors at the OpenCurrentDatabase line. The thrown error is
written to the event log by the calling function. The error is "Rejected
Safe Mode action : Microsoft Office Access." Source: MS Office 11, Category:
None, Event ID: 2001.
When I run the same code in a console app it works fine. The db is opened
and the report is printed.
Does anyone have any idea why the code does not work when used in a service?
Thanks.
Here is my code.
Public Sub PrintReport()
Dim acc As New Access.Application
Try
acc.OpenCurrentDatabase(My.Settings.dbLocation)
acc.DoCmd.OpenReport(_name, Access.AcView.acViewNormal, ,
_filter, Access.AcWindowMode.acHidden)
Catch ex As Exception
Throw ex
Finally
acc.CloseCurrentDatabase()
acc.Quit()
End Try
End Sub
The code errors at the OpenCurrentDatabase line. The thrown error is
written to the event log by the calling function. The error is "Rejected
Safe Mode action : Microsoft Office Access." Source: MS Office 11, Category:
None, Event ID: 2001.
When I run the same code in a console app it works fine. The db is opened
and the report is printed.
Does anyone have any idea why the code does not work when used in a service?
Thanks.