Why does my Access vba open the PDF but then close it after a few seconds?

  Kiến thức lập trình

On button click, my code uses Application.FollowHyperlink to open a PDF that lives on a remote server. The folder containing that file has been shared by giving full control to everyone. The file opens up with Adobe Acrobat, which is weird since the default program to open a PDF on the local server is set to Chrome. The file then closes after about 4 seconds, not sure why. I can navigate to the folder where the file lives on the local server and open it with Chrome just fine. I can also RDP into the remote server and open the file there using Edge by default with no issues. The remote server does not have Adobe Acrobat installed.

Private Sub btnOpenCert_Click()
   
   Dim WO As String
   Dim CoCFolder As String
   Dim CustPO As String
   Dim FilePath As String

   WO = FieldOnForm

   '...run a stored procedure using an ADODB connection, then interpret results...
   
   CoCFolder = GetCoCFolder()
   CustPO = GetPropertyFromWO(WO, 1)
   FilePath = CoCFolder & CustPO & "_" & WO & ".pdf"
   Application.FollowHyperlink FilePath
   
ExitLabel:
   Exit Sub
   
ErrLabel:
   ErrHandler Err.Number, Err.Description
   Resume ExitLabel

End Sub

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT