473,545 Members | 2,469 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 6523
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
23855
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
15418
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
8110
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
2717
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
3496
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...
4
4596
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...
6
5217
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...
1
2476
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...
0
1516
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"?>...
2
1719
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...
0
7490
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...
0
7682
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7935
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...
0
7780
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...
0
6009
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...
1
5351
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...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
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...

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.