473,395 Members | 1,791 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,395 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 4089
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: 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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.