Best way to filter to avoid duplicate pages in report

mikenelena

Board Regular
Joined
Mar 5, 2018
Messages
139
Office Version
  1. 365
Platform
  1. Windows
We print single page reports and e-mail them to clients. When a client has multiple e-mail addresses (stored in a table), the report prints a duplicate page in the pdf document for each e-mail address. We would like only 1 page to print.

If this is to be solved through a filter, should that be done by setting criteria on the query, or in the filter setting on the report itself? Or, might I be better off pursuing a way to specify the print range of the pdf? (To save time on the query.)

I've tried all 3 methods. Setting criteria on the query does in fact limit the number of returned rows to 1, but then inexplicably (to me at least), the report fields are all blank. Setting the filter on the Report simply doesn't filter anything at all. I have tried experimenting with Do.Cmd.PrintOut, but I cannot find an example of how to specify the file name and path with this method such as I can with Do.Cmd OutputTo.

If someone can point me in the right direction, I'd greatly appreciate it!

Thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Have you investigated the data source for the report? It is likely it involves a join to email address information and this query/join needs to be tweaked to take only the default or primary email address.
 
Upvote 0
Solution
Have you investigated the data source for the report? It is likely it involves a join to email address information and this query/join needs to be tweaked to take only the default or primary email address.
I have, BUT... only on the final query. This query pulls from another intermediate query. Maybe your idea will work on that step. I'll try it this afternoon. Thanks!
 
Upvote 0
Great. Post back if you run into any difficulties.
 
Upvote 0
Xenou's suggestion worked. I was too fixated on the final query, and hadn't considered that an intermediate query might be a more appropriate location for the filter. Thanks very much!
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top