Posted 4 August 2017, 6:03 am EST
I found a way to get the report to work over the Web (inspired by looking at another recet post on this board), if I do the following:
Private Sub ActiveReport_Initialize()
Me.Printer.DeviceName = ""
End Sub
The report will run. But, the problem is that we also use the report in a VB6 application where we want to allow printing, so this was not good enough. So I tried to create a module level boolean (mIsWebReport) to conditionally call this line of code. We have a public method that's called in the report that we use to pass in variables. So the code looks something like this:
Private IsWebReport as Boolean 'module level variable
Public Sub StartReport (ByVal WebReport as Boolean)
IsWebReport = WebReport
If IsWebReport Then Me.Printer.DeviceName = ""
End Sub
Private Sub ActiveReport_Initialize()
If IsWebReport Then Me.Printer.DeviceName = ""
End Sub
The report object is instantiated by implication with a call to the StartReport method. By putting in some AppLogEvent calls, I found that the Initialize event gets called before StartReport, so the test for IsWebReport is useless, since IsWebReport will be False. But the code in StartReport should set Printer.DeviceName to an empty string. However, the page is never displayed when the code looks like what I have above.
Is there some event or other way around this problem?
Thanks,
Andy