It's actually pretty simple. You need to use the following API call.
Just copy the Declare and Sub below, and put it in a module.
To use it, the only thing you need to pass it, is the path of your sound. So if your doing this in a distrubuted application, you might want to use the AppPath.
Example:
Private Sub Button_Click()
Call PlaySound("C:\Windows\Media\Office97\Whoosh.wav")
End Sub
That's it. Enjoy
Note: This will NOT work in Access 2.0, am unsure about 95 but I know it works in 97 & 2000, and assume later versions.
Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub PlaySound(strSound)
Call sndPlaySound32(strSound, 0)
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.