Adding Sound (1 Viewer)

lorenzoaj

Registered User
Joined
Nov 26, 2001
Messages
32
Is there a way to add sound to a control button on a Form? Any help would be greatly appreciated.
 

ALANBELL1

New member
Joined
Jul 30, 2001
Messages
5
Lorenzoaj,
You can certainly play a wave sound in Access by inserting a wave sound object
in your form.Suppose your wave sound object was called snd1, to play the sound you would code Me!snd1.Action = acOLEActivate.
Hope this helps.
Regards,
Alan
 

lorenzoaj

Registered User
Joined
Nov 26, 2001
Messages
32
I am kinda new to access and VBA. Everything I've learned I've learned by trial and error and on my own. How do I import the wav file or have it access the wave file. I want to put it in the On_Click Event.
 

wizcow

Registered User
Joined
Sep 22, 2001
Messages
236
lorenzoaj

Try this;
Get the sound onto your form so your button can access it.
1. Open your form in design view
2. Select 'object...' from the 'insert' menu. The 'Insert Object' form opens
3. Scroll to the bottom of the 'object type' listbox and select 'wave sound'
4. Click ok, 'sound object' form opens
5. Select 'insert file' from the 'edit' menu
6. Browse for your .Wav file and open it.
You should now have an OLE object on your form.
7. Select the OLE object and rename it, say, 'snd1'
8. You can also set the visible property to 'No' if you want ot hide it.
now you can tie your button to the sound
1. In the click event of the button, select [event procedure] click the '...' button beside it. This opens the VB window.
2. Add ALANBELL1's code
Me!snd1.Action = acOLEActivate

That should work. Good Luck
Tom

[This message has been edited by wizcow (edited 01-07-2002).]

[This message has been edited by wizcow (edited 01-07-2002).]
 

lorenzoaj

Registered User
Joined
Nov 26, 2001
Messages
32
It worked great. Thanks for all your help. This forum has really helped me learn alot.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom