Running reports by field value

I have a membership database where the membership is broken up by Region and Chapter numbers.

I would like to run a report for each of the 100 chapters with only their membership, and export it to a PDF named "REGION x CHAPTER xxx"  where x=value of region and chapter numbers.

Do I need to make individual exports, or can I do this easily.

Added bonus:  under documents\roster\ I have folders divided by region (7 of them numbered 0 to 6).  I'd like to save the pdf into those folders.
TIgerVAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

als315Commented:
You can do it with DoCmd.OutputTo
Select Region and Chapter in query and loop across records. Look at sample
DBreppdf.accdb
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeCommented:
I generally do this by opening the report (the whole report, with all 100 chapters)

Then I create a recordset and loop through the recordset, filtering the report for each chapter, then save/send the report using docmd.OutputTo and docmd.SendObject methods.  Using this technique ensures speeds things up over opening the report 100 times with a unique WHERE condition.

It might look something like:
docmd.OpenReport "yourReport", acViewPreview
set rpt = reports("yourReport")

strSQL = "SELECT [Chapter], [Region], [ChapterEmail] FROM tbl_Chapters "
set rs = currentdb.openrecordset(strsql,,dbfailonerror)
While not rs.EOF
    rpt.Filter = "[Chapter] = " & rs!Chapter    'assumes Chapter is numeric
    rpt.FilterOn = True

    strFileName = "C:\SomeFolder\" & Format(rs!Region, "00") & "\Chapter_" & Format(rs!Chapter, "000").pdf
    docmd.OutputTo acOutputReport, rpt.name, acFormatPDF, strFileName
    docmd.SendObject acSendReport, rpt.name, adformatpdf, rs!ChapterEmail, , , "Chapter report" 

    rs.MoveNext
Wend

rs.close
set rs = nothing

Open in new window

Using SendObject this way, you may get a bunch of Outlook warning messages popup.  I personally use vbMAPI to handle this issue.
0
TIgerVAuthor Commented:
als315 came in first.  both excellent solutions
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.