473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

In Access, How to Convert Multiple Reports to 1 PDF file?

18 New Member
I want to add a control button to convert all reports for 1 selected record to print in page order as 1 pdf file. There is a control button to print 1 full report per selected record but some users will want to pdf the report to email to clients. What would the VBA coding be for the On Click Event Procedure for the PDF Report button? Or would a macro be better? I am a beginner with VBA & macros so elementary explanations/coding would be helpful....Than k you!
Sep 10 '10 #1
25 18841
liimra
119 New Member
You can use either but I would go for VBA.

If you want to use macro, use the "OutputTo" action. Choose report as Object Type and select the report name.

If you want to use VB
Expand|Select|Wrap|Line Numbers
  1.  DoCmd.OutputTo acReport, "ReportName", acFormatPDF, , True 
Note: "True" will open the Pdf file after completing.

Hope this is what you need,

Regards,
Ali
Sep 10 '10 #2
Otter7
18 New Member
Yes, but do I need to list all the report names? There are 23 individual reports per 1 recored to be a single pdf file in page order...so the user can save the pdf ie as 'One Montgomery Audit'....
Sep 10 '10 #3
Otter7
18 New Member
Wooh! That worked except the pdf file is showing all the records and I need just 1 record selected from a drop down list. The user cannot enter data, preview or print or pdf unless an audit is selected...This is the code I have but wiill add all the rpt nams...

Private Sub btnPDF_Click()
If Audit_Dte_ID = 0 Then
MsgBox "No audidt has been selected"
Exit Sub
End If
DoCmd.OutputTo acReport, "rpt1aAuditorin fo", acFormatPDF, , True

End Sub
-----

How do I code it so pdf is only the selected audit records?
Sep 10 '10 #4
liimra
119 New Member
I have one solution and of course there are others.
When the user chooses the record he/she wants, we search for that record (using the combobox After Update event).

The "Drop Down List" After Update event will be:

Expand|Select|Wrap|Line Numbers
  1.  DoCmd.SearchForRecord , "", , "[Audit_Dte_ID]=" & ComboName.Column(0)
Where Audit_Dte_ID is the first column in the record source of the combo box.

Now, we have the record we want so we just add the code you stated to the Export button.

Expand|Select|Wrap|Line Numbers
  1. If ComboName Is Null Then
  2. MsgBox "No audit has been selected", vbOKOnly, "No Selection"
  3. ElseIf Combo Is Not Null Then
  4. DoCmd.OutputTo acReport, "rpt1aAuditorinfo", acFormatPDF, , True
  5. End If
  6.  
Hope this helps,

Regards,
Ali
Sep 10 '10 #5
Otter7
18 New Member
Ok...I'll give it a try and respond later this evening, California time...off work right now...Thanks and I will respond back...
Sep 10 '10 #6
Otter7
18 New Member
This is the code I entered but it does not work, comes up as error End If:

Private Sub btnPDF_Click()
If Audit_Dte_ID = 0 Then
MsgBox "No audit has been selected"
ElseIf Me.Combo66 Is Not Null Then
End If
DoCmd.OutputTo acReport, "rpt1aAuditorin fo", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt1ProjectBld gInfo", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt2Constructi on", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt3Bldgoccupa ncy", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt4CoolingPla nt", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt5HVACSystem ", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True
DoCmd.OutputTo acReport, "rpt6ComfortHea ting", acFormatPDF, , "Audit_dte_ id=" & Audit_Dte_ID, , True

Continues with all the report names and last line is End Sub..I'm still missing the loop somewhere...
Sep 11 '10 #7
liimra
119 New Member
There are two problems with your code, The "If Statement" and the fact that you can't assign criteria to the OutputTo Function.

In order to overcome the problem you are having and output the selected record only, you open the report first in preview mode then you Output it to PDF. Once this is done, you close back the report preview. Suppose the user cancels the out operation, then he/she will get "cancel" error --> that is why you Resume Next on Error.

So the code will be:

Expand|Select|Wrap|Line Numbers
  1. If (Eval("[Forms]![FormName]![Audit_Dte_ID] Is Null")) Then
  2.  MsgBox "No audit has been selected"
  3.  ElseIf (Eval("[Forms]![FormName]![Audit_Dte_ID] Is Not Null")) Then
  4.  On Error Resume Next
  5. DoCmd.OpenReport "FirstReportName", acViewPreview, , "[Audit_Dte_ID]= " & Forms!FormName!Audit_Dte_ID
  6. DoCmd.OutputTo acOutputReport, "FirstReportName", acFormatPDF, , True
  7. DoCmd.Close
  8. DoCmd.OpenReport "SecondReportName", acViewPreview, , "[Audit_Dte_ID]= " & Forms!FormName!Audit_Dte_ID
  9. DoCmd.OutputTo acOutputReport, "SecondReportName", acFormatPDF, , True
  10. DoCmd.Close
  11. End If
Change names where applicable & add the number of reports you want, and you are done.

Regards,
Ali
Sep 11 '10 #8
Otter7
18 New Member
For the "FormName" I enter the name of the form but for [Forms] I do not enter the form name, correct?
Sep 11 '10 #9
liimra
119 New Member
Correct

Regards,
Ali
Sep 11 '10 #10

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

Similar topics

2
4559
by: Sigurd Bruteig | last post by:
Hi all! I have a problem printing multiple reports. The code i use is: Dim stDocName As String stDocName = "rptInvoice" DoCmd.OpenReport stDocName, acNormal, , " = date()" The problem is that invioce details is printed several times on the same invoice and only the first page is shown as first page, even if all reports have only one page. I gess I have to loop trough the code, but I can't figure out how to.
3
3862
by: MHenry | last post by:
Hi, I have 30 separate Access reports to print to pdf files. Presently, I print these reports to Acrobat pdf files one report at a time. I am looking for some help, or a program or add-in to batch print these multiple reports to one or to separate pdf files.
0
1177
by: mr_doles | last post by:
I have finally got the hang of this ReportViewer control. The one question that I have is dealing with multiple reports. If I have, lets say, 10 rdlc reports should I have 10 WinForms to put them on, or put them on one form a programmatically choose which one to use. I have been doing the second option but have been running into some weird data binding sharing issues. Any thoughts/suggestions?
0
1483
by: genc ymeri | last post by:
Hi over there, Does the .Net20 framework provide library classes/drivers to convert multiple single tiff files into a single multi-pages file or should I use third party tools ? Genc.
0
1075
by: KimJee | last post by:
Dear Sir, I am a Ms access 2003 vb programmer. I want to konw how to convert a Ms Access 2003 graphic reports in to a HTML file. Shall be ever gratefull for the assistance. Kim Jee.
2
6680
by: Thall | last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation The following code loops thru a sales report, using the sales rep ID as a filter so that multiple reports are created. This is now generating a PDF report, but I need to change it to RTF documents. My question is, since I can't create an RTF using open report, is there a way to use the strFilter with the OutputTo...
3
1588
by: Ed | last post by:
Hi, dear all, Now there is a issue to convert C++ into CLI/C++. But there is a issue block me. Say Class MN is multiple derived from class MM and NN. But the CLI only allow single class derived. My understanding is to create a new interface INN with same method declaration with class NN. And let class MN derived from MM and INN, then copy the implementation
0
1176
by: crazycat | last post by:
hello im face a problem with link multiple excel file with one access database for more information : 1- i have 27 excel file to employee that contain account number 2- this 27 excel file store in folder with date of day ( ex , 1(12), ...(15(12)... 31(12 ) and in each day i fill the exel file with data 3- in each day i should transfer the net account in many thing in this file to other excel file to show the net month account 4- i...
0
2094
by: mgarg005SSRS | last post by:
My requirement is to create multiple reports (.rdlc) and show them using single report viewer control. A: User selects a report from drop down list. B: Depending on report name a report has to be displayed in the report viewer. I have handled same scenario in VS2008 as follows: Step1) Created a Dataset Step2) Created multiple TableAdapters in the DataSet (one for each report) Step3) Selected Report-> DataSources. I get the DataSet...
0
8420
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
8842
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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.