Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add sound to command button

Status
Not open for further replies.

JMal

Programmer
Aug 19, 2004
61
IE
I have a sound clip which I want to add to a command buttom.

I have use the "Docmd.Beep" on the unclick event but not very effective.

Is the other built in sounds in Access or can I add my own clip to a button.
 
I used the following in a vb program - not tested in vba tho

first the declaration
Code:
Private Declare Function sndPlaySound Lib "WINMM.DLL" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
   Const SND_SYNC = &H0 ' stops playing and plays from start if called
   Const SND_ASYNC = &H1  ' plays sound from beginning to the end
   Const SND_NODEFAULT = &H2
   Const SND_LOOP = &H8  ' plays sound in a loop
   Const SND_NOSTOP = &H10

now the call to play the sound
Code:
Private Sub nameOfSub()
   Dim x%
   x% = sndPlaySound("c:\testsnd.wav", SND_SYNC Or SND_NODEFAULT Or SND_LOOP)
End Sub

Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top