Module:
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal
filename As String, ByVal snd_async As Long) As Long
Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Public Function PlaySound(msound)
Dim XX%
Dim rtn As Integer
rtn = waveOutGetNumDevs() 'check for a sound card in the machine
If rtn = 1 Then 'a sound card exists
XX% = apisndPlaySound(msound, 1) 'play mmwave sound
Else ' no sound card was found
End If
'If XX% = 0 Then MsgBox ("The Sound Did Not Play! Because you don't have a
sound card.")
End Function
and Load OnClick Event:
'PlaySound ("C:\WINDOWS\CHIMES.WAV") 'or
PlaySound ("G:\Data\Access\MDI\CHIMES.WAV") 'this works on network, if u not
shure that all users have the sound file in their C:\Win.....directory. Note
that u must copy the sound file to this network dir.
paul
Quote:
> win98, access 2000
> in vba, how to play wav sound on click event and form load event? the
sound
> is embeded in the form. thanks.