Limit Query In Reports Fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DAHMB
    New Member
    • Nov 2007
    • 147

    Limit Query In Reports Fields

    I have a report called rptCarSheet based on a Query called qryCombinedCarA bsentee. In the report I have the following fields [AreaID], [Area], [Employee], [Hours], I would like to limit the fields to only show the value if the [AreaID] field is less then 10. The [AreaID] field is a Number field and the other fields are all properly related. I have tried the following but it doesn't work:
    [Code] =IIf([AreaID]>10,[Area]) [Code]

    (I also tried it in reverse incase I had it backwards but no luck)

    Any Ideas

    Thanks
    Dan
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Dan you need to set this criteria in the Open Report event.
    [code=vb]
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Your Report Name"
    stLinkCriteria = "[AreaID]>10"

    Docmd.OpenRepor t stDocName, acPreview, , stLinkCriteria

    [/code]

    Comment

    • DAHMB
      New Member
      • Nov 2007
      • 147

      #3
      Originally posted by msquared
      Dan you need to set this criteria in the Open Report event.
      [code=vb]
      Dim stDocName As String
      Dim stLinkCriteria As String

      stDocName = "Your Report Name"
      stLinkCriteria = "[AreaID]>10"

      Docmd.OpenRepor t stDocName, acPreview, , stLinkCriteria

      [/code]

      Thanks for the reply but I am trying to do it by field and not the whole report because I want the other records in a different group just not in the details section. Maybe I am going about it wrong? Any ideas?
      Thanks

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by DAHMB
        Thanks for the reply but I am trying to do it by field and not the whole report because I want the other records in a different group just not in the details section. Maybe I am going about it wrong? Any ideas?
        Thanks
        If you are saying what I think you are saying and that you want to limit the records in the detail section but show all records in the groups then you will need to look at creating a subreport to do this.

        Create a subreport with this criteria for those records showing in the detail section and set the parent child relationship so that the details pertaining to the relevant group show.

        Comment

        Working...