Many of you must have used MS Access to store several of your information but do you know you can add files to your Access database also? Well MS Access makes this tough task simple by defining a special attachment fields that hold complex data. If you are willing to use the PDF file in Access database then check out this post.
As it is specifically written with the main prospective to provide you all with every pinch of information regarding how to convert MS Access report to pdf file, Import PDF Files into Access Database and export Access report to multiple pdf files.
You can import pdf file in Access database simply by adding it from attachment field. Learn how it is to be done. Here we will perform this in two sections, so that you can understand it more clearly.
1: By Adding An Attachment Field
2: Add PDF To Table
After make the table in database it’s time to insert PDF document into Access Database table.
You will see that your PDF file is get added into the row of the table which you have selected.
After learning how to open or import pdf file in Access database. It’s time to move into our next section i.e how to convert Access report to PDF file.
Here is the step to convert Access report to pdf file. Follow it carefully:
All done…! Now you can see that your Access report is successfully converted to PDF file format.
If you need to perform this task on regular basis then it becomes quiet irritating to perform this manual step. At that time you need some simple solution. With which in just one single click you can immediately export Access report to PDF file.
So, in our next step we will learn how to export Access report to PDF using VBA.
In this section of my post you will learn about how to design a VBA function that help you to convert Access report to PDF file in just one single click of the button.
Now you need not to go every time on your Access menu bar to convert Access report to pdf.
Try the following method if you are already having an Access report. If it’s not then make it first.
Open your Access database design view and then add one button on Report header section. Just as shown in figure.
Assign the name of this button as cmd_exportPDF. For this perform the following steps:
For adding up the code, you firstly need to add one On_Click event on the button.
You have to just copy the below code.
Remember: you have to update the values for file name & folder Path. You can see in the comment section, each one have an asterisk (*).
Function FileExist(FileFullPath As String) As Boolean
Dim value As Boolean
value = False
If Dir(FileFullPath) <> “” Then
value = True
End If
FileExist = value
End FunctionPrivate Sub cmd_exportPDF_Click()
Dim fileName As String, fldrPath As String, filePath As String
Dim answer As IntegerfileName = “Member Contact Details” ‘filename for PDF file*
fldrPath = “C:\Users\Jessica\Desktop\PDF Exports” ‘folder path where pdf file will be saved *filePath = fldrPath & “\” & fileName & “.pdf”
‘check if file already exists
If FileExist(filePath) Then
answer = MsgBox(prompt:=”PDF file already exists: ” & vbNewLine & filePath & vbNewLine & vbNewLine & _
“Would you like to replace existing file?”, buttons:=vbYesNo, Title:=”Existing PDF File”)
If answer = vbNo Then Exit Sub
End IfOn Error GoTo invalidFolderPath
DoCmd.OutputTo objecttype:=acOutputReport, objectName:=Me.Name, outputformat:=acFormatPDF, outputFile:=filePathMsgBox prompt:=”PDF File exported to: ” & vbNewLine & filePath, buttons:=vbInformation, Title:=”Report Exported as PDF”
Exit SubinvalidFolderPath:
MsgBox prompt:=”Error: Invalid folder path. Please update code.”, buttons:=vbCriticalEnd Sub
If it is there, then you will get a prompt message asking regarding the replacement of old file with the new one will comes up on your screen.
At this time if you select the “yes” option then your export Access report PDF process will be continued. If you press the “No” option then the process of conversion will be stopped.
Now it’s time to make a trial to your button.
Wrap Up:
Now you must have got enough idea on how to use PDF file with Access database. So, perform any operation of converting, importing and exporting of PDF file in your Access database effortlessly.
If you are finding, theses manual steps tricky and tough then you can approach for online conversion of Access file to pdf using the Access to PDF converter online.
If meanwhile performing these steps, unfortunately, if you encounter any issue then share it with us. So, that I can help you out to fix that.
Still having issues? Fix them with this Access repair tool:
This software repairs & restores all ACCDB/MDB objects including tables, reports, queries, records, forms, and indexes along with modules, macros, and other stuffs effectively.
Pearson Willey is a website content writer and long-form content planner. Besides this, he is also an avid reader. Thus he knows very well how to write an engaging content for readers. Writing is like a growing edge for him. He loves exploring his knowledge on MS Access & sharing tech blogs.