Solved

wav file for Msgbox

Posted on 2003-11-09
1
245 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

713 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