Wav sound notification

latex88

Registered User.
Local time
Today, 14:01
Joined
Jul 10, 2003
Messages
198
Hi,

I would like to build a form that has a timer to pull a set of data from a query/table. If there's a "New" status in a record, then I would like the form to play a wav file from a location in my hard drive.

Can someone help with the code to pull this wav file?
 
I have followed the article but keep receiving error message of "File not found: mmsystem". The debugger highlights this line in VBA,

XX% = sndplaysound(msound, 1)' play mmwave sound.
 
After further research, below code worked for me. I have Windows 7 MS Access 2010. The code came from http://allenbrowne.com/func-04.html

=PlaySound("C:\WINDOWS\MEDIA\CHIMES.WAV")

' Code Starts

Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long

Function PlaySound(sWavFile As String)
' Purpose: Plays a sound.
' Argument: the full path and file name.

If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If
End Function

' Code Ends
 

Users who are viewing this thread

Back
Top Bottom