ACC2000: How to Record and Play Sounds from Microsoft Access

Article translations Article translations
Article ID: 210067 - View products that this article applies to.
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).

Expand all | Collapse all

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:
  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 With
    End Sub
    					
  7. Add the following event procedure to the OnClick property of the PlayMessage command button:
    Private Sub PlayMessage_Click()
       Me.Message.Action = 7
    End 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.

REFERENCES

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.

Properties

Article ID: 210067 - Last Review: October 11, 2006 - Revision: 2.2
APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbhowto kbinfo kbinterop KB210067

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com