Open an audio file from Access

Bastienggg -  
 Bastienggg -
Hello,

I would like to open Windows Media Player and play a song from an Access form. Let me explain. A simple button has been created, and when I click on it, I manage to open Windows Media Player, but I can't play the song I want. Access allows the opening of .exe files, but I can't play .wma or .mpa files.

Is this operation possible in code or otherwise?

Thank you in advance.
Configuration: Windows XP Internet Explorer 6.0

5 réponses

Polux31 Posted messages 7219 Status Membre 1 204
 
Hello,

As far as I remember, you should be able to do: WMP.URL = "C:\Music\Track1.wma"

;o)

polux
0
Bastienggg
 
It doesn't work, it says: "Required object"
Are there any prior declarations to make?
0
Bastienggg
 
Private Sub Commande2_Click()
On Error GoTo Err_Commande2_Click
Dim stAppName As String

stAppName = "C:\Program Files\Windows Media Player\wmplayer.exe"
wmp.URL = "C:\Documents and Settings\adjoint\Bureau\NORMAL2.wav" => Line of code added

Call Shell(stAppName, 1)
Exit_Commande2_Click:
Exit Sub
Err_Commande2_Click:
MsgBox Err.Description
Resume Exit_Commande2_Click

End Sub
0
Polux31 Posted messages 7219 Status Membre 1 204
 
Hello,

You need to put the Windows Media Player control on your form that you find in the toolbox -> Other controls...
0
Bastienggg
 
Okay, I'll try to manage with this information.

Thanks!!!
0