This is asked and answered often. Read the previous posts. That's why they
are saved.

Signature
Rick B
> Is there a way to play a Wav sound file when a command button is pressed?
Here is a past post of mine on this subject.
You should be able to find something in here to help.
Follow this link to Allen Browne's site:
http://allenbrowne.com.au/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 GotFocus or something.
=PlaySound("C:\StarWarsTheme.WAV")
Make sure you include the full path and extension.
There is also code here:
http://www.mvps.org/access/api/api0011.htm
Example usage like so:
Let's assume you have a field in the table called PathToSoundFile and you
have a corresponding control on the form bound to that field called
txtPathToSoundFile. The code behind the command button would now
look like this:
' *******Code Start*********
Private Sub cmdPlaySound_Click()
On Error GoTo ErrorPoint
Dim strPath As String
If Len(Nz(Me.txtPathToSoundFile, "")) = 0 Then
' No sound file path present so just ignore
' You could also play a "No Sound" file
' or a Windows one if desired
Else
' Sound file path present
strPath = Me.txtPathToSoundFile
fPlayStuff (strPath)
End If
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
End Sub
' *******Code End*********
This will work with forms in Single or Continuous layout.
You optionally could save the record first if you desire as well.
Here is a sample download file by MVP Arvin Meyer:
http://www.datastrat.com/Download/WedOne.zip
And more code and samples here:
Playing sounds in Access:
http://www.pacificdb.com.au/MVP/Code/Sound.htm
Hope that helps,

Signature
Jeff Conrad
Access Junkie
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
> Is there a way to play a Wav sound file when a command button is pressed?
pompeyjim - 29 Jun 2005 20:39 GMT
Thanks Jeff
> Here is a past post of mine on this subject.
>
[quoted text clipped - 66 lines]
>
> > Is there a way to play a Wav sound file when a command button is pressed?
Jeff Conrad - 29 Jun 2005 21:26 GMT
> Thanks Jeff
You're welcome, good luck with your project.

Signature
Jeff Conrad
Access Junkie
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
Matt Vilhena - 10 Mar 2006 05:29 GMT
Thanks, Jeff! Your posting was very useful. I've solved a sound problem I had.
Matt
> Here is a past post of mine on this subject.
>
[quoted text clipped - 66 lines]
>
> > Is there a way to play a Wav sound file when a command button is pressed?
Jeff Conrad - 10 Mar 2006 06:39 GMT
You're welcome Matt, glad to help.
Good luck with your project.

Signature
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
> Thanks, Jeff! Your posting was very useful. I've solved a sound problem I had.
> Matt
mariee4 - 06 May 2007 09:07 GMT
Is there a way to easily play a sound when the form opens in access 2003?
Cheers! :)
> You're welcome Matt, glad to help.
> Good luck with your project.
>
> > Thanks, Jeff! Your posting was very useful. I've solved a sound problem I had.
> > Matt
Douglas J. Steele - 06 May 2007 12:51 GMT
Check http://www.mvps.org/access/api/api0011.htm at "The Access Web"

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Is there a way to easily play a sound when the form opens in access 2003?
> Cheers! :)
[quoted text clipped - 5 lines]
>> > I had.
>> > Matt
holly - 27 Feb 2008 18:57 GMT
I've used the code below and it works perfectly but I was wondering if
there's a way to embedd the sound into a database and not just have it linked?
> Check http://www.mvps.org/access/api/api0011.htm at "The Access Web"
>
[quoted text clipped - 7 lines]
> >> > I had.
> >> > Matt