Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 537

Status
Not open for further replies.

deangelis

Programmer
May 13, 2003
54
ES
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
 
This error is a print engine error for Incorrect Table location

check out this KB
Isoalte out this section and make sure the values are good

-----------
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)
-------------

just a thought

Cheers,

SurfingGecko
Home of Crystal Ease
 
I know the type of the error: The database location is bad!
I read the asp page but it tell about Ado but I'm using DAO.
I have just isolated that section, I read that the database location is bad, but in theory with the lines:
TableLocation.Location = MyDB.name
intResult = PESetNthTableLocation(intJob, i, TableLocation)
I set the databse location!!! Or no?
I don't understand because it don't work!!!!!!!!!!!!
Thanks
Bye
N@pol€on
 
Hi,
there is an update:
Inserting "errore = PEGetErrorCode(intJob)" after
intResult = PESetNthTableLocation(intJob, i, TableLocation)
I discovered that the error code is 503 = string too long!!
Now, there is another problem: The string is not too long.
Infact MyDB.name = C:\Documents and Settings\deangelis\Documenti\PAAMS_Mio\PREPARATION\Db\Objects_Report.mdb
and len(Mydb.name)=89 while the location can be of 256 char.
I try with Rtrim(Mydb.name), but the error is the same!!!!
Maybe the problem is that when i change the location, at the end of the string there isn't the white squares, while when i make gettablelocation after the end of the location there are white squares till the 256 char.
Thanks
N@pol€on

P.s.: Sorry for my bad english
 
i've resolved. The white squares are character that win don't support, they are the final character of the string. Inserting Chr(0) at the end of the string it works.
Thanks
N@pol€on
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top