If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Copy Report with Filter

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-11, 17:06
epifinygirl epifinygirl is offline
Registered User
 
Join Date: Oct 2011
Posts: 1
Question Copy Report with Filter

I currently have 1 report that is summarized by client (1 client per page) and I am looking for correct VBA code to filter and copy the report and save with a new name. In the end, I will need a separate report for each client (It has to be done this way because when we print the file to PDF using Scansoft, it uses the original report name and we need the file name to incorporate the client number as well).

Below is the code that I currently have:
Code:
Public Function OrgIDReports()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlStr As String

sqlStr = "SELECT * FROM [Temp Table]"

Set db = CurrentDb
Set rs = db.OpenRecordset(sqlStr)

rs.MoveFirst

Do While Not rs.EOF
  DoCmd.OpenReport "I# Report", acViewPreview, , "[Carrier Report].[I#]=" & rs![I#], acHidden
  DoCmd****nCommand acCmdSaveAsReport
  rs.MoveNext
Loop

MsgBox ("End of Client Org IDs")

End Function
My issue is that it's saving the copies of the reports with the correct client numbers from the list through the loop, however, it is ignoring the filter option and just resaving the entire report with a different name.

Any thoughts as to how I can copy the report using the filter???
Reply With Quote
Reply

Tags
access, vba

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On