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.
3 6523
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.
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
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: - 'Load recordset
-
Dim strSQL as string
-
strSQL="SELECT * FROM tbl_Company" 'You can add a where clause if you wish
-
Dim rsComp as Dao.Recordset
-
set rsComp=CurrentDB.OpenRecordSet(strSQL,dbopendynaset)
-
-
-
Dim strReportName as string
-
strReportName="rep_Example"
-
-
'Loop over records
-
Do while not rsComp .EOF
-
'To open a report
-
docmd.OpenReport strReportName ,acViewNormal,,"KEY_Company=" & rsComp!KEY_Company,acHidden
-
-
rsComp.MoveNext
-
Loop
-
-
'Cleanup
-
Set rsComp=Nothing
-
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 ?????
|
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.
|
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
|
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
|
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...
| |
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...
|
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...
|
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...
|
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"?>...
|
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...
|
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...
| |
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. ...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| | |