Solved

How to pass recordset from VB?

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

21 Experts available now in Live!

Get 1:1 Help Now