Hi to all:
This is a litlle code that print in Crystal an recordset:
It's possible print 2 recordsets in the same report?Code:Private Sub imprimirreportsintetico() Set Report = New CRAXDRT.Application Set rpt = Report.OpenReport(App.Path & "\Balancete_Sintetico.rpt") ano = balancete_ano balancete_ano = "*" & balancete_ano & "*" If (rpt.HasSavedData) Then rpt.DiscardSavedData Set db = Workspaces(0).OpenDatabase(App.Path & "\progaves.mdb", False, False, ";pwd=agaporni") asql = _ "select categoria, sum(valordebito) as valor1, sum(valorcredito) as valor2 " & _ " from contabilidade" & _ " Where data like '" & balancete_ano & "' " & _ " group by categoria " & _ " order by categoria" Set rs = db.OpenRecordset(asql) Set Data1.Recordset = rs rpt.Database.SetDataSource rs, 3, 1 CRViewer1.ReportSource = rpt CRViewer1.ViewReport
Thanks
End Sub


Reply With Quote