This article is about how to open PDF file in access using VBA code using ActiveX control.
We can embed PDF file using Adobe Acrobat PDF control reader. In this article we are embedding PDF control reader and we are place all the reader control on Microsoft Access form. So for this firstly we are insert a blank form from the toolbar as shown in fig 1.1.
Now select ActiveX control from designing toolbox as shown in Fig 1.2.
After click on ActiveX control a pop up will come and we have insert Adobe PDF reader control So this control will help me to read the PDF file as shown in Fig .1.3.
Now on the form design view we can see PDF reader control. And make the form more customized.
So client can view PDF document and can use control easily. So we have to add buttons and dropdowns as shown in Fig 1.4. And at the event procedures we have write appropriate VBA code to add functionality for these controls.
When we are giving the path of the PDF file then form will view look like as Fig 1.5 in Form View. And on right side of form there are different control listed below.
1. In form view when we are view the PDF file it will not show toolbar so we have to click on Show toolbar button and vice-versa, this will show toolbar on PDF file as shown like Fig 1.6
2. Next button is show scroll bar button on form so when we click on button then scroll bar will show on PDF file as shown in Fig 1.7 and if want hide this scroll bar we have to click again.
3. Next button is Zoom in, so according to need we can Zoom In the file as shown in Fig 1.8. We can use "CTRL +" Key also.
4. Similarly zoom out button, we can change then view according to need as shown in Fig 1.9. We can use "CTRL - "Key also.
5. Next button is page mode, so we can change page mode according to need. In the dropdown we have three modes bookmarks, thumb, none as shown in Fig 2.1.
6. Next button is layout mode. In the dropdown we have following modes:
So we can choose any mode according to need as shown in Fig 2.2.
7. Next button is view. In the dropdown we have following view modes as follow:
So we can choose any mode according to need as shown in Fig 2.3.
8. Next button is "Go to page" button as shown in Fig 2.4 .So we have just put the number inside textbox and click on button then control will automatically go on that particular page.
9. These are bound controls as shown in Fig 2.5 .Button listed below:
So according to need when want move make use of these button we can easily.
Complete VBA code for the procedure is given here: -
Dim ZoomFactor As Double
Private Sub cboLayoutMode_AfterUpdate()
Private Sub cboPageMode_AfterUpdate()
Private Sub cboView_AfterUpdate()
Private Sub cmdFirst_Click()
Private Sub cmdGoToPage_Click()
Private Sub cmdLast_Click()
Private Sub cmdNext_Click()
Private Sub cmdPrevious_Click()
Private Sub cmdShowScrollBars_Click()
If cmdShowScrollBars Then
cmdShowScrollBars.Caption = "Hide Scroll Bars"
cmdShowScrollBars.Caption = "Show Scroll Bars"
Private Sub cmdShowToolBar_Click()
If cmdShowToolBar Then
Me.cmdShowToolBar.Caption = "Hide ToolBar"
Me.cmdShowToolBar.Caption = "Show ToolBar"
Private Sub cmdZoomIn_Click()
ZoomFactor = ZoomFactor + 100
Private Sub cmdZoomOut_Click()
If ZoomFactor <= 100 Then
ZoomFactor = 100
ZoomFactor = ZoomFactor - 100
Private Sub Form_Open(Cancel As Integer)
Dim filePath As String
filePath = "Path for PDF file\FileName.pdf"
AcroPDF0.src = filePath
AcroPDF0.Height = 9000
It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. Access Guru will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.