Microsoft KB Archive/210067

= ACC2000: How to Record and Play Sounds from Microsoft Access =

Article ID: 210067

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210067



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article shows you how to create a form that used Windows Sound Recorder to play and to record sounds. The technique uses Visual Basic for Applications code to open Sound Recorder and to control its functionality from Microsoft Access.



MORE INFORMATION
NOTE: To use this technique, you must have Sound Recorder and a sound input device, such as a microphone, installed on your computer. If your computer has a sound card, Sound Recorder is installed automatically when you set up Microsoft Windows 95 or later.

To play and record sounds, follow these steps:  Start Microsoft Access, and then open the sample database Northwind.mdb.  Create the following table in Design view:   Table:      Messages --  Field Name: Message Data Type: OLE Object  Save the table as Messages, and then close the table. Create a new form in Design view based on the Messages table.  Add the following controls to the form:   Bound Object Frame: Name: Message ControlSource: Message

Command Button: Name: RecordMessage Caption: Record

Command Button: Name: PlayMessage Caption: Play </li>  Add the following event procedure to the OnClick property of the RecordMessage command button: Private Sub RecordMessage_Click With Me.Message .Class = "soundrec" .Action = acOLECreateEmbed .Verb = acOLEVerbPrimary .Action = acOLEActivate End With End Sub </li>  Add the following event procedure to the OnClick property of the PlayMessage command button: Private Sub PlayMessage_Click Me.Message.Action = 7 End Sub </li> Save the form as Messages, and then open it in Form view.</li> To record a message, click the Record command button to open Sound Recorder.</li> Record your message, and then on the File menu, click Exit and Return to Form. To play your recorded message, click the Play command button.</li></ol>

<div class="references_section">