Open A File Using Command Button

Daryl

Registered User.
Local time
Yesterday, 23:13
Joined
May 22, 2001
Messages
34
Using a command button, I am able to open files located in various directories locate on the companies network. The 'On Click' function (is that right) uses the following procedure / code:

Private Sub cmd_ViewForm_Click()
'Set variables for lan directories relating to form field entries
Dim strLinkFileID As String 'Complete network path and specific file info
strLinkFileID = "\\internal\dfs1\act-Sfil_acturl\Bailey\Forms\" & _
Me.FrmAutID & "\" & Me.cbo_FormTerrID & "\" & Me.cbo_FormType & "\" & (Me.FormNum & " " & _
Me.Form_vdt & ".doc")
'strLinkFileID = "\\internal\dfs0\foxcommon1\Business_Teams\Product_Development\TRIWAY_FORMS\" & _
Me.FrmAutID & "\" & Me.cbo_FormTerrID & "\" & Me.cbo_FormType & "\" & (Me.FormNum & " " & _
Me.Form_vdt & ".doc")

'Error Check if file exists - provide not found message, and exit before executing additional code
If Dir(strLinkFileID) = "" Then
MsgBox "A file does not exist for this form in the specified location." & Chr(13) & _
"Please use another system to view this form."
Me.cmd_ViewForm.HyperlinkAddress = ""
Exit Sub
Else
FollowHyperlink strLinkFileID
End If

End Sub

My new problem is that forms may now be in Word, PDF, Excel, or other. Without knowing what the file extension is, how can I look for it? In other words, any ideas to replace the ".doc" to look for other extensions? Or is there a way to return a list of files found and let the user select the appropriate one? I'm stumped.
 

Users who are viewing this thread

Back
Top Bottom