Open Path with shell application!!!

J

jonesfranckandi

Hi everyone,

I have created a form in access where the user can select a file type
with option buttons(Folders) then select the media type. But really
what I want is when the user selects the file and the media, this file
must run directly under the media. like when they click ok, the
application opens up and the file starts playing within the
application. My code is below can someone tell me what I need to add
for it to work functionally. Thanks in advance!!!!!!!. My code is
below:
-------------------------------------------------------------------------------------------------------------------------------------
Private Sub CmdOpen_Click()
' Open the File Open dialog to find a movie.
If Me!Fr.Value = 1 Then

Dim strFilter As String
Dim strInputFileName As String

' Set the filter to only look for MP3 audio files
strFilter = ahtAddFilterItem(strFilter, " MP3 Audio Files(*.mp3,
*.mp2, *.mpa, *.mp1)", "*.mp3; *.mp2;*.mpa;*.mp1")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a file...")

If Len(strInputFileName) > 0 Then
If Len(Dir(strInputFileName)) > 0 Then
Me.txtMP3 = strInputFileName
' Call txtMP3_AfterUpdate to ensure that the same actions happen as if
they'd
' keyed a file name in.
Exit Sub
End If
End If
End If
' do the same for 2
If Me!Fr.Value = 2 Then
' Set the filter to only look for MP3 audio files
strFilter = ahtAddFilterItem(strFilter, " MPEG Files(*.mpg, *.mpeg,
*.mpa, *.mp2)", "*.mpg; *.mpge;*.mpa;*.mp2")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a file...")

If Len(strInputFileName) > 0 Then
If Len(Dir(strInputFileName)) > 0 Then
Me.txtMP3 = strInputFileName
' Call txtMP3_AfterUpdate to ensure that the same actions happen as if
they'd
' keyed a file name in.
Exit Sub
End If
End If
End If
'do the same for 3
If Me!Fr.Value = 3 Then

' Set the filter to only look for MP3 audio files
strFilter = ahtAddFilterItem(strFilter, " Windows Media
Player(*.wma, *.wmv, *.wn)", "*.wma; *.wmv;*.wn")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a file...")

If Len(strInputFileName) > 0 Then
If Len(Dir(strInputFileName)) > 0 Then
Me.txtMP3 = strInputFileName
' Call txtMP3_AfterUpdate to ensure that the same actions happen as if
they'd
' keyed a file name in.
Exit Sub
End If
End If
End If
End Sub
----------------------------------------------------------------------------------------------------------------------------------------
Private Sub PlayMovie_Click()
Dim stAppName As String
If Me!Fr.Value = 1 Then
PlayMovie.Caption = "Play Music"
Else
PlayMovie.Caption = "Play Movie"
Exit Sub
End If
If IsNull(Me.txtMP3) Or Me.txtMP3 = "" Then
Me.txtMP3.SetFocus
MsgBox "Please, Select a Movie or a Music File", vbOKOnly +
vbExclamation, ""
Exit Sub
End If
If Me!Frmovie.Value = 2 Then
stAppName = "C:\Program Files\Real\RealPlayer\realplay.exe\"
Call Shell(stAppName, 1)

Else
If Me!Frmovie.Value = 3 Then
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe\"
Call Shell(stAppName, 1)


Exit Sub
End If
End If

End Sub
 
J

John Nurick

If you've got the filespec in a variable strInputFileName, usually all
you need is:

Application.FollowHyperlink strInputFileName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top