nick243243
New member
- Local time
- Today, 15:55
- Joined
- Oct 11, 2016
- Messages
- 8
We have a working code that opens up adobe on several different versions. We upgraded an employees computer to adobe acrobat 8.0. I added in the new block of code to check for that version. When we go to open a new PDF through the code. It opens up adobe but says it cannot find the file. I stepped through the code and it looks like it is sending the correct file name and opening up the correct adobe. Is there an issue using 8.0 with vba?
Any help would be appreciated.
Thanks,
Nick
Any help would be appreciated.
Code:
Private Sub PO_DblClick(Cancel As Integer)
POV = Me!PO
If Len(POV) = 2 Then POV = "0000" & POV
If Len(POV) = 3 Then POV = "000" & POV
If Len(POV) = 4 Then POV = "00" & POV
If Len(POV) = 5 Then POV = "0" & POV
If IsNull(Me![ID]) = True Then
End
End If
idVar = DLookup("ID", "PO-Details", "Sheet1ID = " & Me![ID])
If IsNull(idVar) = True Then
strfile = Dir("C:\PackingLists\" & POV & ".pdf")
If Len(strfile) > 0 Then
If IsNull(DLookup("PO", "PO-List", "PO = " & Me!PO)) = True Then
MsgBox "PO " & POV & " does not exsist in system. Can NOT open size/color form"
End
Else
FileCopy "C:\PackingLists\" & POV & ".pdf", "K:\Teams and Projects\Receiving\PackingLists\PL-" & Me!PO & "-" & Me![ID] & ".pdf"
Kill "C:\PackingLists\" & POV & ".pdf"
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [PO-Details] ( Sheet1ID, PO, SZ1, SZ2, SZ3, SZ4, SZ5, SZ6, SZ7, SZ8, SZ9, SZ10 ) SELECT " & Me!ID & " AS Sheet1ID, [PO-List].PO, [PO-List].SZ1, [PO-List].SZ2, [PO-List].SZ3, [PO-List].SZ4, [PO-List].SZ5, [PO-List].SZ6, [PO-List].SZ7, [PO-List].SZ8, [PO-List].SZ9, [PO-List].SZ10 FROM [PO-List] WHERE ((([PO-List].PO)=" & Me!PO & "));"
DoCmd.OpenQuery "PackingList-AddCCDetails-CommonCarrier"
DoCmd.SetWarnings True
End If
Else
MsgBox "PO " & Me![PO] & " does not have a packing list is not on file."
End
End If
End If
DoCmd.SetWarnings False
DoCmd.OpenQuery "PackingList-CaptureUnitsOrdered-CommonCarrier"
DoCmd.SetWarnings True
DoCmd.OpenForm "X-Ab-CCEntry-Main", , , "Sheet1ID = " & Me![ID]
idVar = Me!ID
poVar = Me!PO
folder = "K:\Teams and Projects\Receiving\PackingLists\"
If Len(poVar) = 2 Then poVar = "0000" & poVar
If Len(poVar) = 3 Then poVar = "000" & poVar
If Len(poVar) = 4 Then poVar = "00" & poVar
If Len(poVar) = 5 Then poVar = "0" & poVar
sPath = folder & "PL-" & poVar & "-" & idVar & ".pdf"
ChDir ("K:\Teams and Projects\Receiving\PackingLists")
strfile = Dir("K:\Teams and Projects\Receiving\PackingLists\PL-" & poVar & "-" & idVar & ".pdf")
If Len(strfile) > 0 Then
If FileOrDirExists("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe") Then
path = "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
End If
If FileOrDirExists("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe") Then
path = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
End If
If FileOrDirExists("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") Then
path = "C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe"
End If
If FileOrDirExists("C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe") Then
path = "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe"
End If
If FileOrDirExists("C:\Program Files\Adobe\Acrobat 8.0\Acobat\Acrobat.exe") Then
path = "C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe"
End If
X = Shell(path & " " & sPath, vbNormalFocus)
End If
End Sub
Nick