By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,612 Members | 1,632 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,612 IT Pros & Developers. It's quick & easy.

Access Filter Report with Field Name

P: 19
I currently have a report that summarizes my data for each client from the table (each page summarizes the information for each client). I have VBA code all set that can filter each client and print it to PDF (using ScanSoft), however, my issue is that it prints/saves it using the same name as the original file. In the end, I will need a separate file or report for each client. I am looking for a better and more efficient way of doing so rather than manually creating a new report for each client using the filter option and saving it with a new name.

Currently, my code is as follows:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport ("I# Report"), acViewPreview, , "[Carrier Report].[I#]=10936"
In this example, it filters 1 client but when it saves it to PDF, it's saving it as "I# Report".

Any thoughts??
Oct 6 '11 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 931
How many clients are we talking about? It almost seems more laborious to manage a different file for each client as opposed to having just one file where it's one client to each page.

If this is what you really need to do though, the approach that I would take is to populate a recordset with each client ID, and then setup a loop that goes through that recordset and runs the OpenReport action for each client. How does this sound to you?

Oct 6 '11 #2

P: 19
My main problem is saving it with the client's ID in the the name. The OpenReport would be fine with just opening the report and filtering it on a specific client.
Oct 6 '11 #3

Expert Mod 15k+
P: 31,409
We have a problem with your posted code. See When Posting (VBA or SQL) Code.

That said, we can probably guess what it really looks like. I would suggest something like (where txtClient is the control on the form that contains the client number) :

Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenReport(ReportName:="I#" & Me.txtClient & " Report", _
  2.                       View:=acViewPreview, _
  3.                       WhereCondition:="[Carrier Report].[I#]=" & Me.txtClient)
Oct 6 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.