Hi,
I'm trying to make a form in VB that visualize the preview of the report. I'm using the ocx control and CR 8.5 and Access 97 with DAO. I introduced in my project the file global32.bas with the API of CR. The problem is:
I want to change the db name of the subreport inserted in the main report 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.
I'm working with the API functions of the CR.
this is the code:
formula = "{ESSAY.essay_id}='" & SelItem & "'"
intJob = PEOpenPrintJob(App.Path & "\report\Essay-Scenario-Detail.rpt"
intResult = PESetSelectionFormula(intJob, formula)
tablenumber = PEGetNTables(intJob)
For i = 0 To tablenumber - 1
intResult = PEGetNthTableLocation(intJob, i, TableLocation)
dblocation = MyDB.name & Chr(0)
TableLocation.location = dblocation
intResult = PESetNthTableLocation(intJob, i, TableLocation)
Next
subreport.StructSize = Len(subreport)
intResult = PEGetSubreportInfo(intJob, 0, subreport)
errore = PEGetErrorCode(intJob) 'her the problem
I found that the error 502 mean:
"PE_ERR_INVALIDHANDLE:You have specified a handle that does not exist."
Now the question is:
How can I obtain the subreportHandle?
For the table it is simple, there is the method pegetntables that rteturns the table number, but for the subreport?
Thanks
Bye
N@pol€on
I'm trying to make a form in VB that visualize the preview of the report. I'm using the ocx control and CR 8.5 and Access 97 with DAO. I introduced in my project the file global32.bas with the API of CR. The problem is:
I want to change the db name of the subreport inserted in the main report 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.
I'm working with the API functions of the CR.
this is the code:
formula = "{ESSAY.essay_id}='" & SelItem & "'"
intJob = PEOpenPrintJob(App.Path & "\report\Essay-Scenario-Detail.rpt"
intResult = PESetSelectionFormula(intJob, formula)
tablenumber = PEGetNTables(intJob)
For i = 0 To tablenumber - 1
intResult = PEGetNthTableLocation(intJob, i, TableLocation)
dblocation = MyDB.name & Chr(0)
TableLocation.location = dblocation
intResult = PESetNthTableLocation(intJob, i, TableLocation)
Next
subreport.StructSize = Len(subreport)
intResult = PEGetSubreportInfo(intJob, 0, subreport)
errore = PEGetErrorCode(intJob) 'her the problem
I found that the error 502 mean:
"PE_ERR_INVALIDHANDLE:You have specified a handle that does not exist."
Now the question is:
How can I obtain the subreportHandle?
For the table it is simple, there is the method pegetntables that rteturns the table number, but for the subreport?
Thanks
Bye
N@pol€on