[AccessD] Opening Other Program Files

Nicholson, Karen cyx5 at cdc.gov
Tue Nov 8 07:27:54 CST 2005


This is the coding I use:

Option Compare Database   'Use database order for string comparisons
Option Explicit



'Declare Module Level Path Constants
Const WordPerfect = "C:\Program Files\Quick View Plus\PROGRAM\qvp32.exe"
Const MSWord = "C:\cqabapps\viewers\word\wordview.exe"
Const MSExcel = "C:\cqabapps\viewers\excel\xlview.exe"
Const Irfanview = "C:\Program Files\IrfanView\i_view32.exe"
Const Autovue = "C:\Program Files\Volo View Express\Voloview.exe"
Const CDView = "C:\cdview97\cdview.exe"
Const PageMaker = "Q:\install\pm65net\pm65\pm65.exe"
Const CorelDraw = "J:\apps\draw.800\programs\coreldrw.exe"
Const Acrobat = "C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"
Const MSPowerPoint = "C:\Program Files\Microsoft
Office\Office10\Powerpnt.exe"
Const Text = "C:\Program Files\Quick View Plus\PROGRAM\qvp32.exe"

Function OpenDocument()
On Error Resume Next

Dim strDocType As String, strDocLoc As String
Dim strMsgText As String, strMsgTitle As String
Dim MyAppID As Integer

strDocType = Forms![docDocument]![docDocumentSUB].Form![Extension]
strDocLoc = Forms![docDocument]![docDocumentSUB].Form![Path]

Select Case strDocType
        Case "wpd", "txt"
            MyAppID = Shell(WordPerfect & " " & strDocLoc,
vbMaximizedFocus)
        Case "doc"
            MyAppID = Shell(MSWord & " " & strDocLoc, vbMaximizedFocus)
        Case "xls", "xlw"
            MyAppID = Shell(MSExcel & " " & strDocLoc, vbMaximizedFocus)
        Case "dwg", "dxf", "cal"
            MyAppID = Shell(Autovue & " " & strDocLoc, vbMaximizedFocus)
        Case "tif", "pcx", "bmp", "gif", "jpg"
            MyAppID = Shell(Irfanview & " " & strDocLoc,
vbMaximizedFocus)
        Case "dwgrx"
            MyAppID = Shell(CDView & " " & strDocLoc, vbMaximizedFocus)
        Case "pm5", "pm6", "p65"
            MyAppID = Shell(PageMaker & " " & strDocLoc,
vbMaximizedFocus)
        Case "cdr"
            MyAppID = Shell(CorelDraw & " " & strDocLoc,
vbMaximizedFocus)
        Case "pdf"
            MyAppID = Shell(Acrobat & " " & strDocLoc, vbMaximizedFocus)
        Case "ppt"
            MyAppID = Shell(MSPowerPoint & " " & strDocLoc,
vbMaximizedFocus)
        Case "paper"
            strMsgText = "This document was submitted in paper version
only."
            strMsgTitle = "Document Open Failure"
            MsgBox strMsgText, vbOKOnly + vbExclamation, strMsgTitle
            Exit Function
        Case "prev"
            strMsgText = "This document was previously submitted under
another Task Number." & _
                vbCrLf & "Scroll to the right for more information."
            strMsgTitle = "Document Open Failure"
            MsgBox strMsgText, vbOKOnly + vbExclamation, strMsgTitle
            Exit Function
        Case "mdb"
            strMsgText = "Please press the button 'Open SAF' to view the
application form." & _
                vbCrLf & "The application cannot be opened here."
            strMsgTitle = "Document Open Failure"
            MsgBox strMsgText, vbOKOnly + vbExclamation, strMsgTitle
            Exit Function
        Case Else
            strMsgText = "The document type and path information do no
exist for this entry."
            strMsgTitle = "Document Open Failure"
            MsgBox strMsgText, vbOKOnly + vbExclamation, strMsgTitle
            Exit Function
    End Select
    AppActivate MyAppID

End Function 


Karen S. Nicholson
Programmer Analyst
EG&G Technical Services, Inc.
Pittsburgh, PA
Phone: 412-386-6649
Email: cyx5 at cdc.gov


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David Emerson
Sent: Monday, November 07, 2005 5:17 PM
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?

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list