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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR8--VB6/Active Data Driver--Page Header 1

Status
Not open for further replies.

delu0007

Programmer
Aug 28, 2001
26
US
I have a CR8 report created that uses the Active Data Driver to connect to an Access 2000 database or SQL Server 2000 database. The report contains three recordsets, two of which are linked and placed in the details section. The third recordset is in the page header section and is not linked to the other recordsets (there is only one record in the recordset that applies to the entire report). I can choose either database type from CR8 and the report displays properly.

I then tried this report in Visual Basic 6 using the Crystal Automation Server. I can connect to either type of database in code and pass the recordsets using the "SetPrivateData" method of the CRPEAuto.DatabaseTable object. The report displays, but the fields in the Page Header are blank. This is my code for setting the recordsets:
[tt]
For k = 1 To DbTables.Count
Set DbTable = DbTables.Item(CInt(k))
Set cnnRpt = New ADODB.Connection
'IsJetProvider() is a function to determine db type
If IsJetProvider() Then
cnnRpt.Open strAccess
Else
cnnRpt.Open strSQLServer
End If
Set rsRpt = New ADODB.Recordset
rsRpt.Open "SELECT * FROM [" & DbTable.Name & "]", SLARREP.cnn
DbTable.SetPrivateData 3, rsRpt
Next k
[/tt]

Do I have to set any properties for the "crPageHeader" section of the report? Any suggestions??
 
I don't think you can have more than one recordset in a report. When I have tried to link recordsets together I have gotten cartesian results. And anything that is unlinked should not show up at all.

I would combine the fields of the two linked recordsets into one recordset, and use a subreport for the unlinked recordset. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
I recreated a report using one recordset that joins the two data tables and a subreport containing the other recordset. It works in both the CR8 environment as well as in my VB application -- based on either SQL Server or Access.

Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top