|
-
Jul 24th, 2008, 12:31 AM
#1
Thread Starter
Lively Member
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
-
Jul 24th, 2008, 01:06 AM
#2
Re: Crystal report selection formula
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 24th, 2008, 01:44 PM
#3
Re: Crystal report selection formula
Code:
strSelectionfrm = "{tblLeaveApp.Date_App}='" & ndLeaApprDt & "' AND {tblLeaveApp.EmpNo}='" & ndLeaApprEmpNo & "'"
-
Aug 10th, 2016, 12:45 AM
#4
New Member
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
-
Aug 10th, 2016, 02:18 PM
#5
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
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|