Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

Audio when command button is clicked

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nelsonj - 22 Sep 2006 23:11 GMT
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.
pietlinden@hotmail.com - 23 Sep 2006 03:47 GMT
> 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
nelsonj - 25 Sep 2006 15:35 GMT
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.

> > 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
[quoted text clipped - 15 lines]
>
> End Sub
nelsonj - 25 Sep 2006 15:51 GMT
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.

> 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
[quoted text clipped - 21 lines]
> >
> > End Sub
nelsonj - 26 Sep 2006 16:59 GMT
I figured it out.  Nice code...thanks to Dev Ashish for his code!!  Works
well, without
leaving anything open when done.  Thanks again.

> 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
[quoted text clipped - 21 lines]
> >
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.