ACC: How to Play .WAV Sounds on Events in Microsoft AccessLast reviewed: June 8, 1997Article ID: Q95647 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. Microsoft Access does not have a built-in function to play sound files on events, such as when a form is opened or closed. However, you can use the Microsoft Windows 3.1 application program interface (API) through Access Basic code to create a user-defined function to play sound files. This article assumes you are familiar with Access Basic and Windows APIs. In this article, the use of error trapping has been omitted to keep the information as clear and concise as possible.
MORE INFORMATIONFollow these steps to create a user-defined function to play sound files:
When the form is open in Form view, you can play the sound by clicking the command button. You can assign this function to the form's OnOpen property if you want chimes to play when you open a form. NOTE: This example does not have error trapping. Unexpected results may occur if the sound file is not in the location specified or does not exist. If the sound (.WAV file) is in the table as an OLE field, the sound can be added to the form out of the field list. You can then use a macro that does a GoToControl [olefield], DoMenuItem form-edit-object- <verb>. You can run this from a button on the form. It will go to the OLE field and edit the object (the default edit is play for a sound).
REFERENCESMicrosoft Access "Introduction to Programming," Chapters 1-5 "Microsoft Windows Software Development Kit," Microsoft Press, 1992 "Programming Windows: the Microsoft Guide to Writing Applications for Windows 3", Charles Petzold. Microsoft Press, 1990 "Programmer's Reference Library: Microsoft Windows 3.1 Guide to Programming Reference," Volumes 1 - 6, Microsoft Press, 1992
|
Additional query words: sound api how to
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |