Crystal reports, always repeated recording, N repeat N times.

Dim crApp As New CRAXDRT.Application
Dim crRpt As New CRAXDRT.Report
Dim nd As String
nd = Text1.Text
Dim conn1 As ADODB.Connection
Dim rs1 As New ADODB.Recordset
Dim sql1 As String
Set conn1 = CreateObject("adodb.connection")
conn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\The financial revenue and expenditure management.Mdb School Zone;Persist Security Info=False"
sql1 = "Select Distinct * from development and financial revenue and expenditure total where school name = "& Combo2 &'and;" ='" & nd & " ' order by ID asc"
rs1.CursorLocation = adUseClient
rs1.Open sql1, conn1, adOpenStatic, adLockReadOnly, adCmdText

Set crRpt = crApp.OpenReport(App.Path + "\Financial statements.Rpt")
crRpt.DiscardSavedData
crRpt.Database.SetDataSource rs1, 3, 1
crRpt.Database.SetDataSource rs1, 3, 2
crRpt.EnableParameterPrompting = False

crRpt.SQLQueryString = sql1
CRViewer91.ReportSource = crRpt
CRViewer91.DisplayBackgroundEdge = False
CRViewer91.DisplayGroupTree = False
CRViewer91.Refresh
CRViewer91.ViewReport

Started by Cheney at December 07, 2016 - 5:03 PM

sql1 = "Select Distinct * from development and financial revenue and expenditure total where school name = "& Combo2 &'and;" ='" & nd & " ' order by ID asc"


The financial revenue and expenditure total primary and Secondary Development Zone
You look at the table of the original data, should be to view it, may be related to write wrong

Posted by Marcus at December 21, 2016 - 5:45 PM

'Call two times, why? '
crRpt.Database.SetDataSource rs1, 3, 1
crRpt.Database.SetDataSource rs1, 3, 2

Posted by Roderick at December 26, 2016 - 6:18 PM