Solved

How to pass recordset from VB?

Posted on 2001-07-06
5
229 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 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