Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    11

    Unanswered: Filtering Reports

    I have a report that has several sub reports. All of the sub reports utilize the same query. I am trying to use the OnOpen event for each sub report that utilizes an Event Procedure. In a sub report, (forget that there are several; I'll just talk about one), it has a field called "Range". In the Event Procedure is have: DoCmd.ApplyFilter , "[Range] = 'West'". I am trying to filter the data for this sub report where the field "Range" is equal to a text field with a value of "West". I have tried multiple combinations of the DoCmd statement and none of them work. In the example above, I am always asked, "Enter Paramater Value:" The spelling of the field is correct. I have tried using [RangeX] which is the control name instead but it doesn't work. Help Please!

  2. #2
    Join Date
    Oct 2009
    Posts
    340
    If I understand you correctly (and not 100% clear on whether I do...) I would look to implement it via the subreport's filter property.

    Hope this helps.
    www CahabaData com

  3. #3
    Join Date
    Jul 2010
    Posts
    11

    Filtering Reports

    Do you mean instead of using the Event, On Open, put in the Filter property of the sub report? If I use DoCmd.ApplyFilter , "[Range] = 'West'", I get a syntax error about a comma. If I remove the comma, I get Syntax error (missing operator) in query expression.... Actually, I didn't know you could use a DoCmd in the Filter. I change it to = Where [Range] = "West" and got Syntax error (missing operator) in query expression...

    Any ideas?

    Chuck

  4. #4
    Join Date
    Oct 2009
    Posts
    340
    not docmd

    syntax of filter property is just like the Where argument of open report command
    www CahabaData com

  5. #5
    Join Date
    Jul 2010
    Posts
    11
    Got It! I used in the Filter property of the sub report: "[Range]='Reports![West-4]![Text15]'" and I had to add a text box, (Text15), to the sub report where the data was "West".

    Thank you for your guidance. I appreciate it.

    Chuck

  6. #6
    Join Date
    Jul 2010
    Posts
    11
    Didn't get it. It's not returning the right records. I'm using: "[Range]='Reports![West-4]![Text15]'" And "[GraveDesc] = 'Reports![West-4]![Text16]'" with the two text boxes invisible on the form. Frustrated.

Posting Permissions

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