Solved

wav file for Msgbox

Posted on 2003-11-09
1
243 Views
Last Modified: 2012-06-27
I have a field indexed not to allow duplicates.  I would like to prompt a MsgBox to call a wav file instead of the generic message given by MS Access.  Could someone help me with this?

Thanks,

IPT
0
Comment
Question by:iptrader
1 Comment
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 9712943
This code will allow you play any .wav sound through code .

However, if all you want to do is change the standard sounds for Question, Exclamation etc you can do this through Control Panel/Settings in the Sounds option.

Pete

This must go at the top of a module in the genral declarations section:
                                             
       Declare Function apisndPlaySound Lib "winmm" Alias _
       "sndPlaySoundA" (ByVal filename As String, ByVal snd_async _
       As Long) As Long

    '================================================================
    ' The following function PlaySound calls the Windows API function; call it from anywhere
    'Usage  PlaySound("C:\path to file.wav")
     ' example  ?playsound("D:\winnt\media\tada.wav")

 
      Function PlaySound(msound)
         Dim XX%
         XX% = apisndPlaySound(msound, 1) ' play mmwave sound
         If XX% = 0 Then MsgBox "The Sound Did Not Play!"
      End Function
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question