Link to home
Create AccountLog in
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Avatar of dhemple
dhemple🇺🇸

Adobe PDF File Open from MS Access Errors after Upgrade to 8.0
Experts,

I have a command on a form that use to work until Acrobat 8.0 was loaded.  The below command was used to open an Adobe Reader file for the contract of the supplier selected by the user.  Could you please look over the below code and tell me what needs to be changed?  I noticed that the path to Adobe had changed, so I changed it to the following:

stAppName = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  " & stFileName & ""

This change did open Adobe Reader, but it would not open the file.  It gave me an error message stating:  "There was an error opening this document.  This file cannot be found."  I have verified that the file is in the proper place and accessible.  I even moved the file to my "C:\" drive and changed the path reference, and it still errored out.  I'm thinking that there must be a change in how to reference the file to be opened, but I don't know what changed.

Any assistance you can provide in fixing this issue would greatly be appreciated.

Thank you.
Dave

Original Code:
____________________________________________________________
Private Sub cmdOpenAgreement_Click()

Dim stAppName As String
Dim stFileName As String

  stFileName = Forms!frm_main!txtAgreementCoreFileDirectory & Forms!frm_main!txtAgreementFileName
   
  stAppName = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe  " & stFileName & ""
  OpenApp = Shell(stAppName, 1)
   
End Sub

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

dhemple,

You have to get the *exact* Path, Name and extension of the file.

Do a search of "Adobe" on your machine.

Search through this list until you locate the Main Acrobat Reader Executable.
Right click this file and select: Properties

Copy the Exact Location and full file Name to your code as strFileName.

JeffCoachman

Avatar of dhempledhemple🇺🇸

ASKER

Hello Jeff and thank you for responding to my posting.

I have verified several times that I have the *exact* path.  I took the file reference out of the statement, executed the command and Adobe Reader opened with no problems.  It's only when I add the file reference that I'm getting the error.

I have also verified that the FILE reference is correct as well.  I even moved the file to my hard drive and pointed to the new file address, but still getting error.

Im thinking that this has something to do with how the code is written.  Is the file supposed to be referenced in a different way with the new Adobe version?

Thanks
Dave

Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

hemple,

Try this perhaps:

"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  " & "'" & stFileName & "'" & ""

JeffCoachman

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of dhempledhemple🇺🇸

ASKER

Jeff,

Still same result.

David

Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

dhemple,

Make sure you completely uninstall Version 7.

Also try the 8.1 update.
8.1 supposedly addresses some "issues"

JeffCoachman

Avatar of dhempledhemple🇺🇸

ASKER

Jeff,

I now have version 8.1.2 installed and still no luck.  I'm lost on this one...

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

Did you completely uninstall the previous versions?

Then let's take the brute force approach.

What happens if you hardcode the FileName and path?

Private Sub cmdOpenAgreement_Click()
Dim varShell as Variant
    varShell = Shell("C:\Program Files\Adobe\Acrobat 8.1.2\Reader\AcroRd32.exe  c:\YourPDFFile.pdf", 1)
End Sub

JeffCoachman

Avatar of dhempledhemple🇺🇸

ASKER

Hello Jeff

Thank you for hanging in there with me on this one.

First let me state that I do not control the addition or removal of applications.  I have to assume that our IT department has pushed the installation correctly to my system.

I moved the pdf file to my hard drive and kept one with the original name PP-PH9TEV01 Teva.pdf and the other as TestFile.pdf as indicated below.

varShell = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  c:\PP-PH9TEV01 Teva.pdf", 1)
                     
varShell = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  c:\TestFile.pdf", 1)

When I run the code using the file name TestFile, the code executes correctly and displays the pdf file.

When I run the code using the file name PP-PH9TEV01 Teva.pdf, I get an error stating that the file can not be located.

Dont ask me why&..  but I had a hunch that the space between TEV01 and Teva.pdf in the original file name was creating the problem, so I removed the space in the file name and change my code and the code executed correctly.  It would appear that Adobe is having difficulty in handling the space in file names.

As stated before, Prior to the Adobe update, my original code had no difficulty opening the file (with spaces in the name), so Im not sure why all of a sudden they are having problems now.

Any thoughts on this?

Thanks again for your help.

Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

Interesting,

My only guess would be that they had a lot of problems where people could not figure out when and where to use the Double quotes, so they just dropped support for names with spaces.

Very few commercial applications genereate files with spaces in the names anyway.

So now if you insert the "No space" filename into the string variable, does it work?

JeffCoachman

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of dhempledhemple🇺🇸

ASKER

Jeff,

It works with "No space" in the file name.  However, I don't control the file naming, so I'm still back where I started.  Seems so simple to have file names with no spacing as part of the solution.  Corp red tape will surely keep this one a miss for several months.

If you don't have any other suggestion, I lable this one as "busted" and move on.

Thank you.

Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

dhemple,

We could Copy/Rename the files on demand.
Interested?

JeffCoachman

Avatar of dhempledhemple🇺🇸

ASKER

Jeff,

Great suggestion!!!  That may work as file sizes are not that large.  Please tell me how.

Thank you.

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Jeffrey CoachmanJeffrey Coachman🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.