Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Wink Unanswered: Filtering Reports

    How can i create filter by reports ? I would like my user to type in date range and based on that date range report should be open .

    Example: If user wants to preview order reports for one month they will enter "txtStartDate""04-22-04" to "txtEndDate"05-22-04 so when the report is preview its only between the selected date range.

    Pls........Help
    Skharva

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343

    Re: Filtering Reports

    You apply filter on or before opening the report. Once the report is in the preview then you can't change the filter. To change it, you'll have to close the report, reassign your filter values and again run the report.


    Originally posted by Skharva
    How can i create filter by reports ? I would like my user to type in date range and based on that date range report should be open .

    Example: If user wants to preview order reports for one month they will enter "txtStartDate""04-22-04" to "txtEndDate"05-22-04 so when the report is preview its only between the selected date range.

    Pls........Help

  3. #3
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Re: Filtering Reports

    Originally posted by khan
    You apply filter on or before opening the report. Once the report is in the preview then you can't change the filter. To change it, you'll have to close the report, reassign your filter values and again run the report.
    This is the code i use to filter reports. but reports opens up based on the Order date. I would like report to be filter out based on user selectd date range.

    Private Sub cmdGo_Click()
    Dim strCondition As String
    Dim strsql As String
    Dim ctl As Control

    Select Case OptReports
    Case 1

    strName = "rptOrder"
    strCondition = "OrderDate"

    If Not IsNull(txtStartDate) Then

    If IsNull(txtEndDate) Then
    strsql = strsql & " AND OrderDate = " & "#" & txtStartDate & "#"
    ElseIf Not IsNull(txtEndDate) Then
    strsql = strsql & " AND OrderDate Between " & "#" & txtStartDate & "#" & " AND " & _
    "#" & txtEndDate & "#"
    End If

    End If
    DoCmd.OpenReport strName, acViewPreview, , strCondition
    End Select

    End Sub
    Skharva

  4. #4
    Join Date
    Feb 2003
    Location
    Wichita,KS
    Posts
    44
    The easiest way I have found is to use a form to both select the report and enter the dates. If the user needs to run multiple reports for the same date range, he or she enters the dates only once. This also allows you to put the dates on the report. If the dates are simply parameters in a query, you can not address then and use them in the report.

  5. #5
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183
    Originally posted by ray705
    The easiest way I have found is to use a form to both select the report and enter the dates. If the user needs to run multiple reports for the same date range, he or she enters the dates only once. This also allows you to put the dates on the report. If the dates are simply parameters in a query, you can not address then and use them in the report.
    Yes i do have form where user can input date range. And then click on "cmdPreview" to view reports. But for reason its not wrk right with the codes. Do you have example that i can see or any suggestion ?

    Thanks
    Skharva

Posting Permissions

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