1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access & Music Start up

Discussion in 'Business Applications' started by DaveSS, Jan 24, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. DaveSS

    DaveSS Thread Starter

    Joined:
    Jun 18, 2002
    Messages:
    453
    Anyone know how to get a music file to play once a particular DB file is opened.

    It's on a server so it needs to me loaded with this particular DB and not just everytime Access loads.
     
  2. THoey

    THoey

    Joined:
    Feb 12, 2001
    Messages:
    3,420
    I got this from www.tek-tips.com:

    http://www.tek-tips.com/faqs.cfm?spid=181&sfid=41

    How can I attach sounds to my events?
    faq181-41

    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
     
  3. DaveSS

    DaveSS Thread Starter

    Joined:
    Jun 18, 2002
    Messages:
    453
    Thanks for that. However, it's the actual Access file I want a sound applied to.

    eg My Access DB is called SOM.

    When a user double clicks to open it, I want a sound to play too.

    What I don't want to happen, is a sound plays when any other Access DB opens

    Hope this makes sense
     
  4. THoey

    THoey

    Joined:
    Feb 12, 2001
    Messages:
    3,420
    So, add this code and then attach it to the first form that opens for you MDB. That way, the only time the music would be played is when that form is displayed. Maybe a splash screen?
     
  5. DaveSS

    DaveSS Thread Starter

    Joined:
    Jun 18, 2002
    Messages:
    453
    I've tried putting the code on the splash screen but I'm constantly gettign compile errors on form load.

    Any Ideas its 2k
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/115069

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice