Solved

How to pass recordset from VB?

Posted on 2001-07-06
5
226 Views
Last Modified: 2007-11-27
I use VB 6 with Crystal 8.  I want to be able to pass my own recordset to a report i wrote.  Whenever i try to set the property crystalreport1.setdatasource with my recordset, I do not get what i want.  How do i do this?
0
Comment
Question by:RajNeri99
  • 3
5 Comments
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 75 total points
ID: 6261305
In order to pass a recordset to CRW from VB you have to design the report using Active Data (in CRW).  Look in the Developer's help for Data Definition Files or TTX files.

Basically, instead of choosing your database when designing your report in the designer, you choose "Active Data" and then browse to select your data definition file.

A data definition file (or .TTX) file is a tab delimited file that holds the structure of the data that will end up in your recordset, and if you want a single sample value for each field.  Make sure your recordset has everything in it you need for your report before designing your .TTX file.  

After you choose the .TTX file for designing your report, save it and the .TTX file wherever you will be distributing from.  Once you specify a .TTX location you can't change it currently.

In your VB app, load the report and set the datasource before printing it or previewing it.  At runtime, plug your ADO dataset into the RDC report by

dim crAppl as CRAXDRT.Application
dim crRep as CRAXDRT.Report
dim rs as ADODB.Recordset

' bunch of code to setup your recordset and load the data into it

set crAppl = new CRAXDRT.Application
set crRep = crAppl.OpenReport("C:\path\report.rpt")
' Set ADO recordset to first table in report
crRep.Database.Tables(1).SetDataSource rs, 3
' Be sure to insert a CR Smart Viewer on form and then
crViewer1.ReportSource = crRep
crViewer1.ViewReport

Let me know if you are using the CRPEAuto modules because the code is different.
0
 

Author Comment

by:RajNeri99
ID: 6261321
OK so that worked.  Can i pass  any ado recordset like that?  What about joined tables?
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6261341
Any single ado recordset including joined tables can be passed.  Search http://www.crystaldecisions.com for info on multi TTX reports.  I have yet to find a need for one.
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6261343
And thanks for the points.
0
 
LVL 2

Expert Comment

by:joefunsmith
ID: 8552701
Here is a great link for getting up and running with TTX files and ADO
http://support.crystaldecisions.com/communityCS/TechnicalPapers/scr8_ttxado.pdf
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now