Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to pass recordset from VB?

Posted on 2001-07-06
5
Medium Priority
?
237 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 300 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

885 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