Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2003
    Location
    Ocean Gate, New Jersey, USA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding A Sound Wave To A Form (Access 2000)

    I have a form (with some VB Code) that is used as a warning message and is hidden until after a set time of no activity. When the form appears it is displayed as a warning message that the DB. will be shutdown in 5 minutes unless they click the cancel button.

    My question is, is it possible to add a sound .wav to the form? I have experimented with this function on a page but am not sure how to get the page into the form and functioning. My reasoning for this is for the form to play a .wav when it becomes visable allowing the person to realize that the DB will be shut down.

    Any help would be greatly appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding A Sound Wave To A Form (Access 2000)

    You can use something like this (originally from AllAPI):

    This can go in a general module or in the form module:

    Public Const SND_ASYNC = &H1
    Public Const SND_FILENAME = &H20000

    Public Declare Function PlaySound _
    Lib "winmm.dll" Alias "PlaySoundA" _
    (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

    This belongs in the form module:

    Private Sub Form_Load()
    PlaySound "C:WINDOWSMEDIATADA.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
    End Sub

    Substitute the appropriate path and filename for the .wav file.

  3. #3
    Star Lounger
    Join Date
    Sep 2003
    Location
    Ocean Gate, New Jersey, USA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding A Sound Wave To A Form (Access 2000)

    Hans,

    Thank you for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •