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.
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.
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'")
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.