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



The information in this article applies to:

  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97

This article was previously published under Q149119
Moderate: Requires basic macro, coding, and interoperability skills.

SUMMARY

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

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbhowto kbinterop kbProgramming KB149119