Solved

wav file for Msgbox

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Any Way to Print an Import Spec? 3 30
deduplicating based on criteria 2 21
Should I keep recordsets open? 3 24
access query to sql server 3 20
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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 the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

777 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