How to embed and play wav files into a form?

Thanks John,

I'll have a go with this in the morning.

Many thanks.

Ali
 
Hi again,

Thanks but playaudio.zip didn't work for me. For some reason I cannot put a wmp control in my form (Access locks up when I try) and I think this example requires that there is such a control. It wouldn't work anyway..

What is really confusing is that if I hard code the path to the wav file it works brilliantly, without opening wmp. For example:

Public Sub PlayWaveFile_Cord()

Call PlayWaveFile("S:\SFX\robot.wav")

End Sub

....works great. But if I have a text box in a form showing the path to the wav file (from a table) it doesn't work - I just get the Windows error sound..
ie: textbox name is hyperlink:

Public Sub PlayWaveFile_Cord()

Call PlayWaveFile("hyperlink")
'or Call PlayWaveFile("me.hyperlink")
'or Call PlayWaveFile("[forms]![form1].hyperlink")
'tried several strings because being an idiot I have to..
End Sub


Alternatively, I could just click on the control 'hyperlink' in the form and this will actually open wmp and play the wavfile, but not until after a really annoying "some files can harm your computer/virus warning" type message which requires another 'OK' mouse click. As I will want to audition several sounds in quick succession I don't want to have to keep closing this annoying message box. Also, I like the way that the first example code doesn't actually open wmp and take the focus away from Access, it just plays the wav file....


Can anyone help me?
 
What version of Access are your running?

If you open the sample I posted, and enter into the table or form a path to one of your files does it work?

To fix the problem with Hyperlinks, you only had to do a search in Google and you may have found this on the Microsoft site;

Hyperlink & Warnings



.
 
Hi John - thank you for your help.

I am using Access 2000.
I did do a search in Google for this and found that the warning cannot be disabled.
http://support.microsoft.com/?scid=kb;en-us;291912
There is a workaround but it isn't appropriate for me. I didn't think to check whether the 2003 process would work but I have just tried it and it doesn't.

With your sample database, with the path to one of my files inserted, the same thing happens as when I try to put a wmp control in the form - it just hangs Access until I get the 'Not responding' dialog box. No idea why!

I appreciate your help and if you have any other ideas I would be grateful to hear them.

Ali
 
Ali,

Now that could be the problem, I am running Access 2003 (Default file format - 2000).

I have a copy of Access 2000 (used before installing 2003) when I get time I will load it onto a spare PC and give "My Sample" a try.

Gook Luck maybe someone with Access 2000 might give my sample a try and post back.
 

Users who are viewing this thread

Back
Top Bottom