Audio when command button is clicked

G

Guest

I am trying to associate very short audio files with command button "click
events". Is there a way to open the Windows Media Player or some other audio
softare to'play' a short *.wav file when the user clicks a command button? I
can code something behind the click event if I could figure out how to start
execution of a generic audio software with a certain audio file. Thanks.
 
P

pietlinden

nelsonj said:
I am trying to associate very short audio files with command button "click
events". Is there a way to open the Windows Media Player or some other audio
softare to'play' a short *.wav file when the user clicks a command button? I
can code something behind the click event if I could figure out how to start
execution of a generic audio software with a certain audio file. Thanks.

There's code for playing sounds at Accessweb.
http://www.mvps.org/access/api/api0011.htm

you would just use the call in the click event of your button.

Function fPlayStuff(ByVal strFilename As String, _
Optional intPlayMode As Integer) As Long

Sub cmdMyButton_Click()
dim intPlay as integer
intPlay=fPlayStuff("C:\Sounds\MySound.wav")

End Sub
 
G

Guest

In reviewing the code sample provided, is the "code part" of the function
missing, or does the title of the function do it all? I'm confused. There
is no 'end' to the function call...I'm thinking something is missing. I will
try this code to see if it
does play the wav file. Thanks.
 
G

Guest

Piet...Sorry, no sound. Is there code that should be inside the fundtion?
Seems to me that there should be. If I were to use the optional integer,
what number should I put in there?

I can get Access to open the WMedia Player and play the sound, but the
player remains open on top of the Access forms (when I use my logic.) I
can't get the player to auto-close when it finishes the sound file. I'd like
for the user to click the command button and as Access switches to the
subsequent form, play the sound without showing the player...or leaving the
palyer wide open when done.
Thanks.
 
G

Guest

I figured it out. Nice code...thanks to Dev Ashish for his code!! Works
well, without
leaving anything open when done. Thanks again.
 

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

Top