|
I am using vb6 and crystal report 10 (sql server 200 as database) to display record.
I am using .rpt format for crystal report to display data. I am using net examples I am successfully able to display the data but unable to filter it.
I want to know what is the syntax,formula for filtering the report using vb6.
Here is the code I am using to display report.
Public CRReport As New CRAXDRT.Report
Public CRApp As New CRAXDRT.Application
Public Sub CrysRpt(CrytalOCX As Object, RptPath As String, DBPath As String, DBPassword As String)
'-Assign Path to Report
Set CRReport = CRApp.OpenReport(App.Path & RptPath)
On Error GoTo ExitLabel
With CRReport '-// Log-On to Database with Password Protect
'-//====================================
.Database.Tables(1).SetLogOnInfo App.Path & DBPath, App.Path & DBPath, "", DBPassword
End With
With CrytalOCX
'Set the source of Report viewer to the path of Report you made
.ReportSource = CRReport
'View/Display Report
.ViewReport
End With
CRApp.CanClose
Exit Sub
ExitLabel: MsgBox Err.Number & " " & Err.Description, vbCritical
End Sub
Calling Function to display report
On Error GoTo loaderr
Screen.MousePointer = vbHourglass
Call CrysRpt(CRViewer1, "\BanksInformation.rpt", "\My Bank.mdb", "asd987123")
CRReport.ParameterFields(1).AddCurrentValue (250)
Screen.MousePointer = vbNormal
Exit Sub
loaderr:
MsgBox Err.Description
Exit Sub
End Sub
I think I had to add some line to calling function which will filter the data. How do that?
|