ACC2000: How to Record and Play Sounds from Microsoft Access

This article was previously published under Q210067
This article has been archived. It is offered "as is" and will no longer be updated.
Moderate: Requires basic macro, coding, and interoperability skills.

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

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.
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:
  1. Start Microsoft Access, and then open the sample database Northwind.mdb.
  2. Create the following table in Design view:
       Table:      Messages   ----------------------   Field Name: Message   Data Type:  OLE Object					
  3. Save the table as Messages, and then close the table.
  4. Create a new form in Design view based on the Messages table.
  5. 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					
  6. 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 WithEnd Sub					
  7. Add the following event procedure to the OnClick property of the PlayMessage command button:
    Private Sub PlayMessage_Click()   Me.Message.Action = 7End Sub					
  8. Save the form as Messages, and then open it in Form view.
  9. To record a message, click the Record command button to open Sound Recorder.
  10. 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.
For more information about using Microsoft Access as an OLE Automation controller, click Microsoft Visual Basic Help on the Help menu, type understanding automation in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Article ID: 210067 - Last Review: 12/05/2015 11:18:48 - Revision: 2.2

Microsoft Access 2000 Standard Edition

  • kbnosurvey kbarchive kbhowto kbinfo kbinterop KB210067