Results 1 to 5 of 5

Thread: View report between FROM and TO Date[RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  4. #4

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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
  •  



Click Here to Expand Forum to Full Width