473,386 Members | 1,958 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,386 software developers and data experts.

Export Each Access Form to an Individual PDF

Hi,

I've been looking for a solution of my VBA code that will allow me to export each of my Access Form to an individual PDF file with the client name.

My DB structure is:
Id
Anunciante
Campaña Paquete
Plan
Precio
Clicks
Clicks x día

My VBA Code:
Expand|Select|Wrap|Line Numbers
  1. Sub Oneperpage()
  2.     Dim MyDB As DAO.Database
  3.     Dim MyRS As DAO.Recordset
  4.     Dim strSQL As String
  5.  
  6.     'Used to create a Recordset of Employee IDs for Form Filtering for each
  7.     'Employee. [EmployeeID] is the Primary Key making the job easy
  8.     strSQL = "Select Anunciante From Data;"
  9.  
  10.     Set MyDB = CurrentDb
  11.     Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly)
  12.  
  13.     With MyRS
  14.       Do While Not MyRS.EOF
  15.         RecordSource = "Select * From Data Where [Anunciante] = " & _
  16.                            ![Anunciante]
  17.         'Form has a single Record only, Output it to a unique PDF File
  18.         DoCmd.OutputTo acOutputForm, "Anunciante", acFormatPDF, "C:\Test\" & _
  19.                        ![Anunciante] & ".pdf"
  20.          .MoveNext
  21.       Loop
  22.     End With
  23.  
  24.  
  25.     MyRS.Close
  26.     Set MyRS = Nothing
  27. End Sub
Thanks for your help,
A.
May 8 '13 #1
1 2195
Taaner
16
Hey, can you tell us what your concrete question is?

Is the VBA code not working at all, do you get an error message, are the files not/wrong created?
May 13 '13 #2

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

Similar topics

2
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
3
by: sam | last post by:
Can you teach me how to export access file to excel file in VB.net? Thank in advance.
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
1
by: chaphets | last post by:
access 2003 Need help to export access form into html or xml documents. Advice appreciated, thanks
1
by: ielamrani | last post by:
Hi, I have the following code which works fine. It export current access form record to an excel sheet: DoCmd.OutputTo acOutputForm, "frmsubformtest", acFormatXLS, "C:\Details.xls", True Is it...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
0
by: JFKJr | last post by:
Hello everyone! I am trying to export Access table data into Excel file in such a way that the table field names should be in the first line of each column in excel file followed by field data, and...
7
by: kpresidente | last post by:
Hello all, I'm trying to transfer the value of a control on an Access form to an Excel worksheet using VBA. The Access form is a single form with all the controls disabled, so that data is "read...
2
by: Susan Littlefie | last post by:
I want to know an easy way to export Access data to Quickbooks.
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.