Link to home
Start Free TrialLog in
Avatar of darls15
darls15

asked on

Create, name and save PDFs documents from a MSAccess form

Hi Experts

I am hoping to create certificates directly from my database and have them named and saved as PDFs.

I've attached an example database to help explain what I am hoping to achieve. What I need help with is some code attached to a button on a form  (frmCreateCerts), that will create certificates for all records appearing in the qryCreateCerts query.

When the button is clicked I need the code to do the following actions...
   - create and save certificates as PDFs for all records in the qryCreateCerts query by inserting the [Full Name] into the certificate (frmCertificate)
   - save them into C:\Certificates\ folder on my computer
   - name each one using this format: [Full Name]_[Course]_[Today's Date].pdf, e.g. Stephen Lowe_Digital Practice_2016-08-09.pdf
   - once PDFs have been created, update the fields [CertIssued] = TRUE and [IssueDate] = Today's Date, in the tblRegistration table

I really don't have the knowledge to manipulate code snippets I've found and so would be very appreciative if anyone could please help me achieve this.

Thanks
darls15
Create_Certificates.accdb
Avatar of Antonio Salva Ripoll
Antonio Salva Ripoll
Flag of Spain image

Hi darls15.

Instead of give you a full working solution, I'll explain you how to do it. (If you give a man a fish, this man will eat one day; if you teach him to fish, he will eat every day (Ancient chinese proverv))

To create pdf files is better to use reports than forms. Reports are intended to be printed, same as pdf files, while forms are intended to be the interactive part with the user.

So, the first you must do is create the Certificate report.

In the report properties, one of them is the DataSource, this property connects the report with the data you want print, in your case, the query.

Now, you can adjust the fields to meet your needs and with the Access Assistant, you can create the action to open the report.

Best regards.
Avatar of Jim Dettman (EE MVE)
darls15,

 I would consider posting this as a Gigs project if you don't feel your up to the task:

https://www.experts-exchange.com/gigs/

 If you do want to tackle it yourself, then take it one step at a time and ask a series of questions on each aspect.  

 Antonio has already gotten you started in the right direction.  After getting the report set, then get it into a PDF format.

 Once that's done, then tackle the file naming, and finally updating the DB to indicate that the certificate has been posted.

 Ask one question on each task so your not over whelmed in trying to sort through it all at once.  While it seems simple, what you asked really covers quite a bit of ground and how you do it depends on the version of Access your using, where it will be used, etc.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of darls15
darls15

ASKER

Antonio and Jim, thanks for the advice and pointing me in the right direction. I'm slowly learning how to read, change and understand VBA through searching, reading and most of all through the help and advice I receive here. I've never had formal training on building databases/writing code but it is an area that I am liking very much. I will now change my approach and start with a report for this task rather than a form. Jim, I've not heard about the "Gigs" site and will check it out for future reference.

Helen, wow, thank you so much for providing me with this code! Emailing the certificates is my next step after getting the PDF creation working! This will give me the opportunity to learn something new without getting so confused that I give up! I don't know how to write code from scratch (apart from the basics), but by the time I implement it into my database I will understand how it works and this is precisely how I am learning as I go.

Anyways, I will get to this task right now and let you know how I go!
Avatar of darls15

ASKER

Apologies for taking so long in getting back here. This worked great, thanks Helen. Your help is much appreciated.