Solved

How to pass recordset from VB?

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 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