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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR Reports from VB using Print Engine calls/ADO

Status
Not open for further replies.

Ericksco

Programmer
Jul 5, 2001
10
0
0
US
Hi All,

I have a SQL/ODBC based CR Report that I run off a VB application by binding an ADO recordset to the report at runtime. I build the recordset by passing a pre-bilt SQl statement in VB. The first time I got it running it worked just fine but it won't work now. Could there be something wrong with my code? My CR report? Can anybody please help...

==============================
Here is a part of my code:
Handle = PEOpenEngine
If Handle <> 0 Then
'Print engine is opened
Else
ErrorNum = PEGetErrorCode(Handle)
MsgBox &quot;Error in opening Crystal Report print engine.&quot;, vbInformation
GoTo ExitPoint
End If

'Open print job
job = PEOpenPrintJob(strPath & &quot;FollowUp2.rpt&quot;)
If job <> 0 Then

Else
ErrorNum = PEGetErrorCode(job)
MsgBox &quot;Error opening print job.&quot;, vbInformation
GoTo ExitPoint
End If

'Set record source to rstInfo
Handle = SetActiveDataSource(job, 0, rstInfo)

'Create a field definition file and check if creation was successful
Handle = CreateFieldDefFile(rstInfo, strPath & &quot;ado.ttx&quot;, True)

'Send report output in a window
Handle = PEOutputToWindow(job, &quot;FollowUp2.rpt&quot;, 0, 0, 520, 520, 0, 0)
'Start Print Job
If Handle <> 0 Then
Handle = PEStartPrintJob(job, True)
Else
MsgBox &quot;Error starting print job.&quot;, vbInformation
GoTo ExitPoint
End If

=========================
Environment:

Crystal Reports Ver. 6
Windows NT
Oracle Ver. 7...
ODBC Connection
Using Print Engine API Calls

Please let me know if you need more details.

Thanks,

Erick
 
Hi Ken,

No, I don't get any error messages.
 
Thank you Ken I found my mistake. It seems like I needed a little more prodding to find it..The culprit was my report. I was using an old .TTX file and it doesn't match my recordset. I have read somewhere that these two should always match for this to work.

 
There was a mixup on my previous post.

I was using a new .TTX file and an OLD report to get the matter straight. (Not old TTX file and new Report)

To make it work I just re-created my report based on the new .TTX file.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top