Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    apply filter to subreport (2003 SP3)

    I have a report for individual information with a subreport that lists all members in the family. I am getting the following Run-time error '2101' : The setting you entered isn't valid for this property. What I need to achieve is to filter out the individual on the main report from the list of family members. E.g. if there is a husband, wife and child, I only want the wife and child to show as family members when I print his individual info. Likewise, the husband and child should show up as family in the wife's individual info.

    The report is based on a query and the subreport based on a separate query. The two are joined by a family ID number.

    I have determined that this error is popping up because Access doesn't like the code in the subreport detail's Format event nor does it like it in the subreport's Open event. What I can't figure out is where to put it. Here is the code I am trying to use. A) Is this correct? and where should I use it?

    Private Sub Report_Open(Cancel As Integer)
    Dim strID As String
    Dim strWhere As String
    strID = [Reports]![rptIntakeForm]![ImmSINNum]
    Me.Filter = "[ImmSINNum] <> '" & strID & "'"
    Me.FilterOn = True
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: apply filter to subreport (2003 SP3)

    You cannot set the Filter property of a subreport. You'll have create a query that selects records whose ImmSINNum is not equal to [Reports]![rptIntakeForm]![ImmSINNum], and use that query as record source for the subreport.

  3. #3
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: apply filter to subreport (2003 SP3)

    Thanks Hans. As usual 5 minutes of time from you is worth an hour plus of <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

Posting Permissions

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