Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OPEN .PDF FILE FROM ACCESS

Status
Not open for further replies.

mdavis1

Programmer
Aug 14, 2000
30
US
I WANT TO BE ABLE TO SEARCH AND FIND A CUSTOMER/LOCATION/#, THEN WHEN THAT FILTERS, I WANT TO BE ABLE TO OPEN THE SCANNED PIC OF THE # FILE FROM A COMMAND BUTTON.THANKS IN ADVANCE.
YA'LL ARE GREATTTTTTTTTTTTTTTTTTT.
 
Here's a piece o code I stole from somewhere... let me know if you have problems.

'***************Usage Examples***********************
'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL)
'Call Email app: ?fHandleFile("mailto:dash10@hotmail.com",WIN_NORMAL)
'Open URL: ?fHandleFile(" WIN_NORMAL)
'Handle Unknown extensions (call Open With Dialog):
' ?fHandleFile("C:\TEMP\TestThis",Win_Normal)
'Start Access instance:
' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
'****************************************************

Function fHandleFile(stFile As String, lShowHow As Long)
Dim lRet As Long, varTaskID As Variant
Dim stRet As String
'First try ShellExecute
lRet = apiShellExecute(hWndAccessApp, vbNullString, _
stFile, vbNullString, vbNullString, lShowHow)

If lRet > ERROR_SUCCESS Then
stRet = vbNullString
lRet = -1
Else
Select Case lRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
& stFile, WIN_NORMAL)
lRet = (varTaskID <> 0)
Case ERROR_OUT_OF_MEM:
stRet = &quot;Error: Out of Memory/Resources. Couldn't Execute!&quot;
Case ERROR_FILE_NOT_FOUND:
stRet = &quot;Error: File not found. Couldn't Execute!&quot;
Case ERROR_PATH_NOT_FOUND:
stRet = &quot;Error: Path not found. Couldn't Execute!&quot;
Case ERROR_BAD_FORMAT:
stRet = &quot;Error: Bad File Format. Couldn't Execute!&quot;
Case Else:
End Select
End If
fHandleFile = lRet & _
IIf(stRet = &quot;&quot;, vbNullString, &quot;, &quot; & stRet)
End Function
'************ Code End **********
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top