Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I would simply filter the report with the above technique. I never open queries for the user (forms and reports only), and I've never used ApplyFilter. If I had to guess, the last argument is probably supposed to be a string value too.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    cactuspete13 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2012
    Posts
    53
    The control source on the blocks is a DCount formula counting a field in the query. How would I go about making the database add that filter? I'm trying to avoid specially modifying the query for close to 100 seperate front ends (long story). I'm trying to count personnel across several companies in multiple departments within those companies based on their pay grade. At the highest level, all personnel are counted. But I am trying to filter that count based on their selection from one of two listboxes that shows the companies and the departments. So box1 has a control source of

    =DCount("[PaygradeGrp]","[PersonnelInfoQ]","[PaygradeGrp]=1") 'There are four of these'

    I am trying to get the VBA code to add an additional filter that would work the same as changing the above formula to:

    =DCount("[PaygradeGrp]","[PersonnelInfoQ]","[PaygradeGrp]=1 And [Department]='Sales'") or =DCount("[PaygradeGrp]","[PersonnelInfoQ]","[PaygradeGrp]=1 And [Company]='SportingGoods'")

  3. #18
    cactuspete13 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2012
    Posts
    53
    Nevermind, figured it out. Linking a text block in the report, pulled from the query, into the DCount formula, then use your code to only display that company. Thanks for the help.

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open Report filtered by Date in ListBox
    By TinaCa in forum Programming
    Replies: 1
    Last Post: 03-06-2012, 02:29 PM
  2. Replies: 29
    Last Post: 02-13-2011, 01:21 AM
  3. Exporting report selected from a listbox to excel
    By GARCHDEA in forum Import/Export Data
    Replies: 1
    Last Post: 08-10-2010, 07:45 AM
  4. Report won't open
    By okakopa in forum Reports
    Replies: 1
    Last Post: 05-24-2010, 04:09 AM
  5. open report from a vb form
    By tracamonali in forum Reports
    Replies: 2
    Last Post: 08-10-2009, 01:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums