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

Last reviewed: August 28, 1997
Article 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 demonstrates 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.

To play and record sounds, follow these steps:

  1. Create the following new table in Design view:

    Table: Messages --------------- Field Name: Message

             Data Type: OLE Object
    
    

  2. Save the table as Messages, and then close the table.

  3. Create a new form in Design view based on the Messages table.

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

  5. Add the following event procedure to the OnClick property of the RecordMessage button using the Code Builder:

    Me!Message.Class = "soundrec" Me!Message.Action = acOLECreateEmbed Me!Message.Verb = acOLEVerbPrimary Me!Message.Action = acOLEActivate

  6. Add the following event procedure to the OnClick property of the PlayMessage button using the Code Builder:

    Me!Message.Action=7

  7. Switch the form to Form view.

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

  9. Record your message, and then click "Exit and Return to Messages" on the File menu.

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

Keywords          : AutoGnrl kbinterop IntpOleA
Technology        : kbole
Version           : 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.