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:
- Start Microsoft Access, and then open the sample database Northwind.mdb.
- Create the following table in Design view:
Table: Messages
----------------------
Field Name: Message
Data Type: OLE Object
- Save the table as Messages, and then close the table.
- Create a new form in Design view based on the Messages table.
- 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
- 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
- Add the following event procedure to the OnClick property of the PlayMessage command button:
Private Sub PlayMessage_Click()
Me.Message.Action = 7
End Sub
- Save the form as Messages, and then open it in Form view.
- To record a message, click the Record command button to open Sound Recorder.
- 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.