ACC: How to Record and Play Sounds from MS Access (95/97)

ID: Q149119


The information in this article applies to:
  • Microsoft Access versions 7.0, 97


SUMMARY

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

This article shows you how to create a form for playing and recording sounds using the Windows Sound Recorder. The technique uses Visual Basic for Applications to open the Windows Sound Recorder and to control its functionality from Microsoft Access.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.


MORE INFORMATION

NOTE: The technique described in this article requires that you have the Windows Sound Recorder and a sound input device (such as a microphone) installed on your system. If your computer has a sound card, the Windows Sound Recorder is installed automatically when you set up Microsoft Windows 95 or later.

To play and record sounds, follow these steps:

  1. Create the following new table in Design view:


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


  6. 
          Bound Object Frame:
            Name: Message
            ControlSource: Message
    
          Command Button:
            Name: RecordMessage
            Caption: Record
    
          Command Button:
            Name: PlayMessage
            Caption: Play 
  7. Add the following event procedure to the OnClick property of the RecordMessage button:


  8. 
          Me!Message.Class = "soundrec"
          Me!Message.Action = acOLECreateEmbed
          Me!Message.Verb = acOLEVerbPrimary
          Me!Message.Action = acOLEActivate 
  9. Add the following event procedure to the OnClick property of the PlayMessage button:


  10. 
    Me!Message.Action=7 
  11. Switch the form to Form view.


  12. To record a message, click the Record button to open the Windows Sound Recorder.


  13. Record your message, and then click "Exit and Return to Messages" on the File menu. To play your recorded message, click the Play button.



REFERENCES

For more information about using Microsoft Access as an OLE Automation controller, search the Help Index for "OLE Automation," and view the available topics.

Additional query words:

Keywords : kbinterop IntpOlea
Version : WINDOWS:7.0,97
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: September 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.