[AccessD] Opening Other Program Files

Andy Lacey andy at minstersystems.co.uk
Mon Nov 7 16:51:38 CST 2005


Hi David
Sounds like you want RunApp. See fn below. I'm afraid I don't recall who to
credit. Just call RunApp passing it the filename. Don't recall when you need
the 2nd param but I alwys pass a value of 1 and it works fine.

Function RunApp(strFile As String, bytSize) As Boolean
    Dim lngRet As Long
    Dim varTaskID As Variant
    Dim strRet As String
    
    lngRet = ShellExecute(hWndAccessApp, vbNullString, strFile,
vbNullString, vbNullString, bytSize)
    If lngRet > Success Then
        strRet = vbNullString
        lngRet = -1
        RunApp = True
    Else
        RunApp = False
        Select Case lngRet
            Case NotRegistered
                varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL "
& strFile, bytSize)
                lngRet = (varTaskID <> 0)
            Case InadequateMemory
                MsgBox "Error:  Out of Memory/Resources!"
            Case FileNotFound
                MsgBox "Error:  File not found!"
            Case PathNotFound
                MsgBox "Error:  Path not found!"
            Case BadFormat
                MsgBox "Error:  Bad File Format!"
            Case 5
                MsgBox "Error:  Unauthorized due to Security restrictions!"
        End Select
    End If
End Function


HTH
-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> David Emerson
> Sent: 07 November 2005 22:17
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Opening Other Program Files
> 
> 
> I have a field that has the full path to a file.  The file may be a 
> pdf or word doc.  My user would like to be able to doubleclick the 
> field and have the correct application open with the file (eg double 
> click on a pdf will open Acrobat with the file showing).
> 
> Any pointers on how this can be done?
> 
>




More information about the AccessD mailing list