Adding a sound on exiting the database (1 Viewer)

sondriven

Registered User.
Local time
Yesterday, 19:04
Joined
Jun 13, 2002
Messages
158
I want to add a sound for when someone quits the database.

Ive tried adding this to the Event of my Quit Application button.

Me!ByeBye.Action = acOLEActivate

I inserted the sound file into the form.

But it does nothing. Could I bother someone for some help with this?
Thanks
 

ghudson

Registered User.
Local time
Yesterday, 19:04
Joined
Jun 8, 2002
Messages
6,195
Copy this into a module...

Option Compare Database
Option Explicit

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

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

Public Sub PlayWaveFile_Cord()
Call PlayWaveFile("C:\Windows\Media\chord.wav")
End Sub

My example will play the standard 'chord' wave file. To call it from another event in your db, just use this...

Call PlayWaveFile_Cord

HTH
 

Ashfaque

Student
Local time
Today, 04:34
Joined
Sep 6, 2004
Messages
894
Nice code Ghudson.

Thanks for sharing...

With kind regards,
Ashfaque
 

Users who are viewing this thread

Top Bottom