Crystal report selection formula
I have a problem with the selection formula to be used by crystal report 10. At first I just set one selection formula and it's work and now i want to used two selection formula but I do not know how to write it. Below is the code and the word highlight with red color is the formula i want to add.Can anyone teach me how..
Code:
Private Sub ListView1_DblClick()
ndLeaApprEmpNo = Trim(ListView1.SelectedItem.SubItems(3))
ndLeaApprLCode = Trim(ListView1.SelectedItem.SubItems(1))
ndLeaApprDt = Trim(ListView1.SelectedItem.SubItems(4))
'MsgBox ndLeaApprEmpNo & ", " & ndLeaApprLCode & ", " & ndLeaApprDt
Unload Me
Me.MousePointer = vbHourglass
Dim crApp As CRAXDRT.Application
Dim Report As CRAXDRT.Report
Dim strSelectionfrm As String
Set crApp = New CRAXDRT.Application
Set Report = crApp.OpenReport("C:\Program Files\Microsoft Visual Studio\VB98\Projects\LeaveApp\LeaveForm2.rpt")
Report.Database.Tables(1).SetLogOnInfo "SQL", "tebrauteguh", "sa", "sa"
'{tblLeaveApp.EmpNo}='" & ndLeaApprEmpNo & "' -->another selection formula i want to add, how to combine both
strSelectionfrm = "{tblLeaveApp.Date_App}='" & ndLeaApprDt & "'"
Report.RecordSelectionFormula = strSelectionfrm
Report.DiscardSavedData
Form8.CRV.ReportSource = Report
Form8.CRV.ViewReport
Form8.Show
Form6.Hide
Me.MousePointer = vbNormal
End Sub
Re: Crystal report selection formula
Re: Crystal report selection formula
Code:
strSelectionfrm = "{tblLeaveApp.Date_App}='" & ndLeaApprDt & "' AND {tblLeaveApp.EmpNo}='" & ndLeaApprEmpNo & "'"
1 Attachment(s)
Re: Crystal report selection formula
Can anyone help me to sort by date using selection formula?
Im currently using this codes
Code:
Me.CrystalReport11.SetDataSource(Me.DtrdbDataSet)
Me.CrystalReportViewer1.SelectionFormula = "{DTR_REC.SDATE} IN DateValue (" & DateTimePicker1.Value.ToString("MM/dd/yyyy") & " ) TO DateValue (" & DateTimePicker2.Value.ToString("MM/dd/yyyy") & " )" And "{DTR_REC.MEM_CODES} =" & Me.txtpin.Text
Me.CrystalReportViewer1.RefreshReport()
Me.CrystalReportViewer1.Refresh()
But the problem is 8/1/2016 found on the last portion.. It should be on the first data above...like in ascending order
8/1/2016
8/2/2016
upto
8/31/2016
Attachment 140073
Re: Crystal report selection formula
You should order the data set or use the Record Sort Expert
If you decide to use the RecordSort Expert, it's located in :
main menu
Report
RecordSort Expert
and select the field(s) that you want to use to order the report output