|
-
Mar 16th, 2005, 12:27 AM
#1
Thread Starter
Frenzied Member
View report between FROM and TO Date[RESOLVED]
Hello everybody,
I have a table "ActivityLog" which tracks all the activities of the users. For viewing ActivityLog, I am using crystal report. I need to select "From" and "To" date from Form with DatePicker control and show the activities within these dates.
How do I pass "From" and "To" date to the crystal report as parameter.
Thanks.
Last edited by usamaalam; Mar 16th, 2005 at 07:24 AM.
-
Mar 16th, 2005, 12:50 AM
#2
Re: View report between FROM and TO Date
Are you using an ADO Recordset as a DataSource? If so you can just modify your sql query to
include a where clause that will limit the records to between the two dates.
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 
-
Mar 16th, 2005, 12:52 AM
#3
Re: View report between FROM and TO Date
If you are using a selection formula in CR, create two parameters and add them to
your selection formula. Then pass the two parameters like in my link's example.
CR Parameter
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 
-
Mar 16th, 2005, 01:05 AM
#4
Thread Starter
Frenzied Member
Re: View report between FROM and TO Date
I am using SelectionForumula like this:
Code:
swotreportDoc.Load( Application.StartupPath.ToString() + "\\Reports\\ActivityLogReport2.rpt");
swotreportDoc.Refresh();
swotreportDoc.RecordSelectionFormula = "{ActivityLogForReport.Time} >=" + fromDateTimePicker.Value + " And {ActivityLogForReport.Time} <=" + toDateTimePicker.Value;
swotcrystalReportViewer.ReportSource = swotreportDoc;
How do I add parameter in crystal report ??
Thanks
-
Mar 16th, 2005, 07:21 AM
#5
Thread Starter
Frenzied Member
Re: View report between FROM and TO Date
I resolved the problem with this selection formula.
Code:
swotreportDoc.RecordSelectionFormula = "CDate({ActivityLogForReport.Time}) >= Date(" + fromDateTimePicker.Value.Year + "," + fromDateTimePicker.Value.Month + "," + fromDateTimePicker.Value.Day + ") And CDate({ActivityLogForReport.Time}) <= Date(" + toDateTimePicker.Value.Year + "," + toDateTimePicker.Value.Month + "," + toDateTimePicker.Value.Day + ")";
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
|