attach a .wav file

A

April

Can I somehow attach a .wav file to an event.
I not at all adept with vb code, and have had no success
at all in making this work.

I have two .wav files, one which needs to play on a "On
Enter" for a field and one on a "On Change" event . Is
this possible? Thanks!!

April
 
J

Jeff Conrad

Hi April,

Follow this link to Allen Browne's site:

http://users.bigpond.net.au/abrowne1/func-04.html

1. Create a new module and add in the code as instructed
2. Then just add code like this to whatever event you
want. Such as OnEnter or something.

=PlaySound("C:\StarWarsTheme.WAV")

Make sure you include the full path and extension.

There is also code here, but I have not used this:

http://www.mvps.org/access/api/api0011.htm

Hope that helps,
Jeff Conrad
Bend, Oregon
 
P

PC Datasheet

From My file:
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

Play A Sound In Any Event



To play a sound in any event, just set an event such as a form's OnOpen to:

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

Paste the following declaration and function into a module and save:


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top