Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    filter report for today (Access 2000)

    I want to filter a report in such way, that to show only the records made on the same day.What is the simplest method
    to filter the report to these records?Of course the content of the report will vary with the course of the day, but i want
    whenever i open the report to get the filtered results.How can i do this?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: filter report for today (Access 2000)

    If you are opening the report with a command button then you can add a "where" condition to the OpenReport command to limit the records to those that satisfy a condition.

    e.g.

    <pre> Dim stDocName As String
    Dim strCriteria As String
    stDocName = "rptReportName"
    strCriteria = "[DateField]=#" & Format(Date, "mm/dd/yyyy") & "#"
    DoCmd.OpenReport stDocName, acPreview, , strCriteria
    </pre>



    Replace rptReportName with the name of your report, and DateField with the name of the Date field in your report.
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filter report for today (Access 2000)

    Thank you very muich for your reply. How can i combine 2 Where conditions ? I have already one where where condition in my command button as follows
    DoCmd.OpenReport "rptOpenIssues", acViewPreview, , "Employees_1.EmployeeID = " & Me.Office
    How can i add on the second one ?

    Kind regards

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: filter report for today (Access 2000)

    You can put multiple where conditions in, separated by AND.
    I prefer to bracket each condition to avoid any potential ambiguity.


    <pre> Dim stDocName As String
    Dim strCriteria As String
    stDocName = "rptOpenIssues"
    strCriteria = "([DateField]=#" & Format(Date, "mm/dd/yyyy") & "#) and (Employees_1.EmployeeID =" & Me.Office & ")"
    DoCmd.OpenReport stDocName, acPreview, , strCriteria
    </pre>

    Regards
    John



  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filter report for today (Access 2000)

    Thank you !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •