Microsoft Knowledge Base Email Alertz

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.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 210067 - Last Review: October 11, 2006 - Revision: 2.2

ACC2000: How to Record and Play Sounds from Microsoft Access

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:
  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.

APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbhowto kbinfo kbinterop KB210067
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate