473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Access 2007: create a report per group

22
I have a report that is grouped by a field. I have looked for ways in which it would be possible to obtain an individual report for each group to export to PDF. Since if I have all groups in the same report, it is saved in only one PDF file when I exported. So right now, I modify manually the query from the report is based on to select only one group every time and obtain each PDF as a separate file for each group.

I want to know how I could automate to have individual reports in PDF files for each group without having to manually, modify the query to select the group.

I would greatly appreciate the help because so far it has been unsuccessful my search. Thanks!
Jun 6 '08 #1
2 4087
puppydogbuddy
1,923 Expert 1GB
This might work.
1. Go to your report, highlight the GroupID, invoke the property sheet and set the "New Page" property (for each group) to yes.
2. In the query that is the source of the report, create an alias column for the Sequence. Your revised query would look something like this....replace the illustrative names I used with the actual names you use.
Expand|Select|Wrap|Line Numbers
  1. SELECT ((SELECT COUNT(*) FROM tblYourTable
  2. WHERE tblYourTable.GroupID < tblYourTable.GroupID) + 1) AS Sequence,
  3.  tblYourTable.GroupID, Name From tblYourTable Order By GroupID;
3. Now that you have a consecutive sequence, you can print your reports in an incremental fashion with your open report statement in your report launcher as shown below:
Expand|Select|Wrap|Line Numbers
  1. Dim X as Integer            ' variable used to store the Max value of Sequence
  2. Dim Y as Integer           ' variable used for loop counter
  3.  
  4. X = DMax("[Sequence]", "YourQuery")
  5.  
  6. For Y = 1 to X
  7.     'execute the Access Version of the report in preview mode
  8.     DoCmd.OpenReport "XXXXXX", acViewPreview, , "Sequence = " & Y
  9.  
  10.     'next execute the code that uses the "outputto" statement that can be used to direct the report to a pdf printer as can be done natively with Access 2007 (illustrated below) or by using Lebans ReportToPDF on his web site at:   http://www.lebans.com  for Access versions prior to 2007.
  11.  
  12.       DoCmd.OutputTo acOutputReport, "yourReportName", acFormatPDF, "c:\yourReportName"  & ".pdf", False
  13.  
  14. Next Y
Jun 9 '08 #2
NeoPa
32,556 Expert Mod 16PB
Design the report to print everything, then have a loop in your code which cycles through each group you want and open (& print) the report with the matching filter.

This will produce each report as a separate PDF result file.
Jun 13 '08 #3

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

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
5
by: Ira Solomon | last post by:
Hi: Any quick opinions on Access 2007? Has anyone got this to coexist with Access 2003? Thanks Ira
2
by: Wayne | last post by:
I've been having a click around Access 2007 this afternoon and have discovered some things that range from annoying to alarming. My Access 2003 menu bars, which I, like many others, use...
1
by: bobykim | last post by:
Hi All, I'm using MS Access 2003 in a Windows XP environment. I've created an aging report for my department that is based on what I call the "Main query" with an IIf statement that allows the...
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
1
by: sjivanjee | last post by:
Help In Access 2007 - Report (Grouping and Sub Totaling) I have two table one stores student information and other one is for their attendance. In the attendance table their is a field called...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
3
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.