Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filter on Report & Subreport (Access 2000)

    Can you help me. I have a form that opens a report. On the form the user selects the beginning year, then the ending year, then the loss ratio percent (equation). Basically I have the program filter on the years and then I need a filter on the loss ratio. When that is done the result is in the report. I can get the filter for the years, but I can not get the program to filter on the loss ratio. The report contains the years and the sub report contains the loss ratio.
    This is my code:
    'Description: This Sub will open the loss ratio report between the two years
    ' listed and for all records with a loss ratio greater than what was entered
    '
    Private Sub Command8_Click()

    Dim stDocName As String
    Dim stLinkCriteria

    stDocName = "Loss Ratio Summary"
    stLinkCriteria = "[From] >= cdate(" & Chr(34) & "1/1/" & [Combo3] & Chr(34) & ") And [To] <= cdate(" & Chr(34) & "1/1/" & [Combo5] & Chr(34) & ")" '& " And Reports![Loss Ratio Summary]![Loss Ratio Query2 subreport]![Loss Ratio] >= " & [Text0]

    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

    End Sub

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter on Report & Subreport (Access 2000)

    You can't set the filter for the subreport in the criteria for the docmd line.
    Use :
    'Description: This Sub will open the loss ratio report between the two years
    ' listed and for all records with a loss ratio greater than what was entered
    '
    Private Sub Command8_Click()

    Dim stDocName As String
    Dim stLinkCriteria

    stDocName = "Loss Ratio Summary"
    stLinkCriteria = "[From] >= cdate(" & Chr(34) & "1/1/" & [Combo3] & Chr(34) & ") And [To] <= cdate(" & Chr(34) & "1/1/" & [Combo5] & Chr(34) & ")"

    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

    Then put a filter in the filter property of the subreport. Something like :
    [Loss Ratio] >= Forms!MyFormName!Text0

    Replace FormName with the name of your form.
    Francois

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter on Report & Subreport (Access 2000)

    Thank you. I will try this.

Posting Permissions

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