473,662 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access report to pdf, split by company grouping and e-mailed to company

4 New Member
I have an access report with groupings for approx 40 companys, i would like to know the vba code to PDf the report split and save the report by each company grouping and then sent to an relevant e-mail address. I new to writing VBA code so any help would be appreciated.
Apr 21 '11 #1
3 6531
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
What version of access are you using? Access 2007 and later I believe has a built in pdf converter, though I have never tried it.

To output each group by itself would involve looping through them in VBA code, printing of each report with a WHERE clause to filter by that group. Adding it to an email is yet another issue.
Apr 22 '11 #2
Piers
4 New Member
Yeah its access 2007 i'm using, its the looping code that i need the help with both the pdf creation and the e-mail i think i can work out. but if someone could with the looping code i'd be there
Apr 26 '11 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
What you would need to do is load a recordset of the companies, and loop through it. It could look like this, assuming you have a company table tbl_Company with primary autonumber key, KEY_Company:
Expand|Select|Wrap|Line Numbers
  1. 'Load recordset
  2.   Dim strSQL as string
  3.   strSQL="SELECT * FROM tbl_Company" 'You can add a where clause if you wish
  4.   Dim rsComp as Dao.Recordset
  5.   set rsComp=CurrentDB.OpenRecordSet(strSQL,dbopendynaset)
  6.  
  7.  
  8.   Dim strReportName as string
  9.   strReportName="rep_Example"
  10.  
  11. 'Loop over records
  12. Do while not rsComp .EOF 
  13.   'To open a report
  14.     docmd.OpenReport strReportName ,acViewNormal,,"KEY_Company=" & rsComp!KEY_Company,acHidden 
  15.  
  16.   rsComp.MoveNext
  17. Loop
  18.  
  19. 'Cleanup
  20.   Set rsComp=Nothing
  21.  
  22.  
This would print you a report for each company. How to modify that code to output pdfs instead I don't know as I dont use Ac2007.
Apr 26 '11 #4

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

Similar topics

3
23870
by: Nicola | last post by:
Hi Everyone, I am new to programming and would like to know how to open an access Report from within vb 6. I am trying to write a program to organise cross stitch threads. I have found out how to use a database table but all I want to do now is to click a command button to display this access report. Any suggestions please ?????
2
15424
by: Tom Weddell | last post by:
Can I call an Access report from VB.Net? (I'm using access as the backend.) Thanks in advance.
2
8124
by: Vikrant | last post by:
Hey Friends I need to export an Access Report using a filter. I am using the method OutputTo m_pDoCmd->OutputTo( 3, // asOutputReport COleVariant(strReportName), // <report name> COleVariant(_T("HTML (*.html)")), // acFormatHTML
3
2730
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have reports at the plan (overall totals), department and division levels which have sorting and grouping implemented with this new
8
3508
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At the moment the printed output is usually going to Word. It's turning into an unholy mess, because I'm having to prepare umpteen different Word templates, and the queries that drive them, depending on what events a course has.
4
4602
by: ApexData | last post by:
I have one table used to maintain information on Service Events. Each record contains a Repair, Maint, and Battery checkbox (bound/boolean). Any one of these fields may be checked or left empty. Ex. REPAIR=True, MAINT=False, BATTERY=True I want to generate ONE report that lists all the REPAIRS, then lists all the MAINT, and then lists all the BATTERY events. One group after the other in the same report. Because (ex. REPAIR and BATTERY)...
6
5220
by: DeniseY | last post by:
I have an Access report that is created on the fly by the user selecting the fields to be included. The Access report comes out fine, but I want it to automatically output to an Excel spreadsheet. Again, I have this part working. But the fields in the resulting spreadsheet are in a different order than the Access report. (Example: The fields in the Access report might go FirstName, LastName,Address,City--in the Excel spreadsheet, they come up...
1
2489
by: sonicfun2006 | last post by:
I have SQL Server Database and MS Access 2003 is connected with ODBC. I have very large amount of records in various tables. The database is very dynamic as it changes every minute. I’m trying to have a live MS Access report which would pull data from SQL Server. I’ll try to explain how I’m trying do this: The Access report should have two parts: 1. Title page report, just like table of contents. It should be listing a particular field of a...
0
1519
by: Hvid Hat | last post by:
Hi At first, I thought I could only solve my problem with a C# method inside my XSLT but I'm beginning to think it might be possible with XSLT only. So I'm trying, but I need help :-) How can I split a grouping into 3 parts? I've got the following grouping of countries which is working fine: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
1729
by: plaguna | last post by:
I created an Access report grouping by departments. Also a have Subtotals of the Sell-Price for each of 5 department. I have no problem to add all the Subtotals as a Grand Total, but my question is: How can I add or subtract the Sell-Price Subtotals of only two departments and not the 7 of them?. I looked for it everywhere and I tried all the possibilities I could. If you have any ideas, please let me know. plaguna
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.