Hi,
I'm trying to make a from in VB that visualize the preview of the report. I'm using the ocx control and CR 8.5 an Access 97. I introduced in my project the file global32.bas with the API of CR. The problem is:
I want to change the db name like when i print the report. Infact if the report is printed it works fine with any db name, but if I choose the preview that is the error code.
In the file global32.bas is specified:
"If it is unable open the table, PE_ERR_DATABASELOCATION is set, and the application should update with PESetNthTableLocation."
I have tried but nothing.
this is the code:
intResult = PEOpenEngine()
intJob = PEOpenPrintJob(App.Path & "\Report\Essay-Scenario.rpt"
WindowOptions.StructSize = Len(WindowOptions)
With WindowOptions
.hasGroupTree = 0
.canDrillDown = 0
.hasNavigationControls = 0
[CUT]
End With
tablenumber = PEGetNTables(intJob)
TableLocation.StructSize = Len(TableLocation)
SessionInfo.StructSize = Len(SessionInfo)
intResult = PEGetNthTableSessionInfo(intJob, i, SessionInfo)
intResult = PESetWindowOptions(intJob, WindowOptions)
intResult = PEShowPrintControls(intJob, 0)
intResult = PEOutputToWindow(intJob, "Report Preview", 0, 0, 0, 0, 1, pctPreview.hwnd)
For i = 0 To tablenumber - 1
intResult = PESetNthTableSessionInfo(intJob, i, SessionInfo, True)
intResult = PEGetNthTableLocation(intJob, i, TableLocation)
TableLocation.Location = MyDB.name
intResult = PESetNthTableLocation(intJob, i, TableLocation)
intResult = PETestNthTableConnectivity(intJob, i)
errore = PEGetErrorCode(intJob) 'here the error!!!
Next
intResult = PEStartPrintJob(intJob, True)
errore = PEGetErrorCode(intJob)
intResult = PEZoomPreviewWindow(intJob, 1)
Thanks to all
Bye
N@pol€on
P.S: I know that if i use the RDC or also the ocx with the option print to window I have the result, but I prefer my form
I'm trying to make a from in VB that visualize the preview of the report. I'm using the ocx control and CR 8.5 an Access 97. I introduced in my project the file global32.bas with the API of CR. The problem is:
I want to change the db name like when i print the report. Infact if the report is printed it works fine with any db name, but if I choose the preview that is the error code.
In the file global32.bas is specified:
"If it is unable open the table, PE_ERR_DATABASELOCATION is set, and the application should update with PESetNthTableLocation."
I have tried but nothing.
this is the code:
intResult = PEOpenEngine()
intJob = PEOpenPrintJob(App.Path & "\Report\Essay-Scenario.rpt"
WindowOptions.StructSize = Len(WindowOptions)
With WindowOptions
.hasGroupTree = 0
.canDrillDown = 0
.hasNavigationControls = 0
[CUT]
End With
tablenumber = PEGetNTables(intJob)
TableLocation.StructSize = Len(TableLocation)
SessionInfo.StructSize = Len(SessionInfo)
intResult = PEGetNthTableSessionInfo(intJob, i, SessionInfo)
intResult = PESetWindowOptions(intJob, WindowOptions)
intResult = PEShowPrintControls(intJob, 0)
intResult = PEOutputToWindow(intJob, "Report Preview", 0, 0, 0, 0, 1, pctPreview.hwnd)
For i = 0 To tablenumber - 1
intResult = PESetNthTableSessionInfo(intJob, i, SessionInfo, True)
intResult = PEGetNthTableLocation(intJob, i, TableLocation)
TableLocation.Location = MyDB.name
intResult = PESetNthTableLocation(intJob, i, TableLocation)
intResult = PETestNthTableConnectivity(intJob, i)
errore = PEGetErrorCode(intJob) 'here the error!!!
Next
intResult = PEStartPrintJob(intJob, True)
errore = PEGetErrorCode(intJob)
intResult = PEZoomPreviewWindow(intJob, 1)
Thanks to all
Bye
N@pol€on
P.S: I know that if i use the RDC or also the ocx with the option print to window I have the result, but I prefer my form