Hello everyone,
I am trying to use a command button to play an MP3 file through Windows Media Player.
The button will be used in a form, and the file I would like to play is inside a field called Filename in the form.
Filename describes the path to the music file (ie. c:\music\3 doors down - kryptonite.mp3)
The code I have is:
****************************************************
Private Sub Play_File_Click()
On Error GoTo Err_Play_File_Click
Dim stAppName As String
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe /play " & Me![Filename]
Call Shell(stAppName, 1)
Exit_Play_File_Click:
Exit Sub
Err_Play_File_Click:
MsgBox Err.Description
Resume Exit_Play_File_Click
End Sub
*******************************************************
However, it doesn't play the current file in the field Filename, in fact it doesn't play anything. I am not a big programming fan, so I am a bit stuck here. I suspect it has something to do with the spaces in the filename path (ie. 3 doors down - kryptonite.mp3)
Help!
I am trying to use a command button to play an MP3 file through Windows Media Player.
The button will be used in a form, and the file I would like to play is inside a field called Filename in the form.
Filename describes the path to the music file (ie. c:\music\3 doors down - kryptonite.mp3)
The code I have is:
****************************************************
Private Sub Play_File_Click()
On Error GoTo Err_Play_File_Click
Dim stAppName As String
stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe /play " & Me![Filename]
Call Shell(stAppName, 1)
Exit_Play_File_Click:
Exit Sub
Err_Play_File_Click:
MsgBox Err.Description
Resume Exit_Play_File_Click
End Sub
*******************************************************
However, it doesn't play the current file in the field Filename, in fact it doesn't play anything. I am not a big programming fan, so I am a bit stuck here. I suspect it has something to do with the spaces in the filename path (ie. 3 doors down - kryptonite.mp3)
Help!