Click to See Complete Forum and Search --> : filtering reports in a dataenvironment in VB6
Ewasonyiro
May 7th, 2008, 06:35 AM
Hallo guys,
I'm still learning vB and would like to know how to filter report in a dataenvironment. For example I'm doing a water billing and would like to print an invoice for a customer and also a receipt.Another example would be to get all the customers with balances. Thanks in advance
Hack
May 7th, 2008, 07:30 AM
Moved to Reporting
kuldevbhasin
May 7th, 2008, 11:44 AM
hi...
this is what i have done and it works.....though there may b bettr way to do it...and am new to vb.net this code i have used for vb.net 2003
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Dim crForm As New FrmReportViewer
Dim Fltr As String
Dim mRpt As New rptRecoverySheetSent
Try
Dim CRViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer
crForm.CrystalReportViewer3.ReportSource = mRpt
Fltr = "{RecoveryStatmentSent.BranchCode} = '" & txtBranchCode.Text & "'"
If txtSubBranchCode.Text = Nothing Then
Else
Fltr = Fltr & " AND {RecoveryStatmentSent.SubBranchCode} = '" & txtSubBranchCode.Text & "'"
End If
Fltr = Fltr & " AND Day({RecoveryStatmentSent.FromDate}) = " & Day(dtpkFromDate.Value)
Fltr = Fltr & " AND Month({RecoveryStatmentSent.FromDate}) = " & Month(dtpkFromDate.Value)
Fltr = Fltr & " AND Year({RecoveryStatmentSent.FromDate}) = " & Year(dtpkFromDate.Value)
crForm.CrystalReportViewer3.SelectionFormula = (Fltr)
crForm.Show()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.