Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to CR: Report w/ ADO recordsett 1

Status
Not open for further replies.

mjbosko

Programmer
Jun 26, 2002
248
US
Looking for the best way to get a report written for an app. I'm running VB6 that connects to SQLserver7 using a 3-tier approach. I am only given recordsets to pass to a crystal reports report.

I just want to find a way to start out, by creating a very simple report (say, a list of VendorID, VendorName, Phone Number) and pass it a recordset to produce the output. Then have it integrate into VB.

The user's manual doesn't seem to touch on passing a recordset to a report. Where can I learn how to do this? I've seen the examples but they don't use ADODB.Recordsets, they use ADODB.command. But all I get from my middle tier is an ado recordset object -- is this still possible?? I can't use the data environment, it has to go thru my middle tier.

ANY help would be appreciated!!! I'm feeling lost and so danged short on time.

Thanks!
 
Whew! THATS what I was hoping to find on the Crystal site, but it never turned up. Thank you!
 
Implementing the code and am having a problem. Can someone take a look and see what I might be missing here. I did find what looked to be an error in the example, or it was a version difference:
The example showed the following
Dim crAppl As CRAXDRT.Application
Dim crRep As New CRAXDRT.Report
It appears that CRAXDRT should be CRAXDDRT.

Here is what I'm doing that gives me an 'Object variable or With Block variable not set' message at the line:
Set crRep = crAppl.OpenReport(PathFix(App.Path) & "RS.rpt")

I have set reference to "Crystal Reports 8.5
ActiveX Designer Design and Runtime Library" as well as the "ActiveX Data Objects 2.6 Library" in my project. The CRViewer control is on my form.

In frmCrystalReport...
Option Explicit
Dim crAppl As CRAXDDRT.Application
Dim crRep As New CRAXDDRT.Report

Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim cBizRule As clsdbBusinessRules
Set cBizRule = New clsdbBusinessRules
Set rs = cBizRule.get_Customers(gUserID)
'ERROR occurs here
Set crRep = crAppl.OpenReport(PathFix(App.Path) & "RS.rpt")
crRep.Database.Tables(1).SetDataSource rs, 3
CRViewer1.ReportSource = crRep
CRViewer1.ViewReport
Set rs = Nothing
Set cBizRule = Nothing
End Sub

Any ideas??
 
Oops. In the above example I left a test piece in there:

Dim crRep As New CRAXDDRT.Report
should be
Dim crRep As CRAXDDRT.Report

I threw NEW in there as a last ditch attempt. Both, however, give the error.

sorry for the confusion.
 
Another bit, I modified:
Dim crAppl As New CRAXDDRT.Application
Dim crRep As CRAXDDRT.Report
to the declaration section of the form. (added part is New for crAppl).

This got me the report, but I have no data. The report still shows the sample data I created in my ttx file. The report design references the ttx file as the data source. In the code, I set the data source as my recordset. Do I have to create a new ttx file when I generate the final report in code??

I'm going nuts here. Thanks for any help you can provide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top