INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Howto:

How can I attach sounds to my events? by jimmythegeek
Posted: 26 May 00 (Edited 17 Oct 06)

It's actually pretty simple. You need to use the following API call.

Just copy the Declare and Sub below, and put it in a module.

To use it, the only thing you need to pass it, is the path of your sound. So if your doing this in a distrubuted application, you might want to use the AppPath.

Example:
Private Sub Button_Click()
    Call PlaySound("C:\Windows\Media\Office97\Whoosh.wav")
End Sub

That's it. Enjoy

Note: This will NOT work in Access 2.0, am unsure about 95 but I know it works in 97 & 2000, and assume later versions.



Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Sub PlaySound(strSound)
    Call sndPlaySound32(strSound, 0)
End Sub

==========================

Jim Lunde
jimlunde@gmail.com

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close