Question Mute all sounds

HandSam

Registered User.
Local time
Yesterday, 23:44
Joined
May 18, 2012
Messages
48
Hi, in my Access Database, I have welcome sounds that play when one opens the database. However, I would like to add a button that one can click so as to mute all sounds if they wish to.
The code that plays the sound is as follows:

Dim iRetValue As Long
iRetValue = sndplaysound(CurrentProject.Path & "\Welcome.wav", SND_ASYNC)

Is there a way that I can add a button that can edit this code, so that it can maybe make the code a comment by adding: ' ?
Or is there a better way to stop these sounds?
Thank you, looking forward to your reply
 
I'm not sure if you can edit VBA using VBA. Instead, I would have the button set a value somewhere, either a global variable/switchboard textbox or a table depending on whether you want this setting to be saved for this session or all sessions. The value just needs to be a True/False value where each time you click the button, it will change from True to False or False to True. Then you just need an IF statement for your sound playing code.
 
Wow, I had not thought of that, I will do that now, I am really grateful. I am sure that will work. Thanks, but I will make u know just incase I find any anomally. Thanks a bunch Neutron
 
It worked Neutron, Thank you very Much. Thanks again
 

Users who are viewing this thread

Back
Top Bottom