Music in Access

G

Goirish1904

Is there anyway to play music in Access when you open a form or just in
general. I'm pretty sure that you cannot but can someone please write in and
provide me the correct answer?
 
G

Goirish1904

Where would I put that code at if I were to use it? I would like to put it
in a form that I use all of the time. I take it you put it in the code
builder. Also could you give me the code that I can just copy and paste if
the file path is C:\Documents and Settings\cjjerge\My Documents\My
Music\Seether\One Cold Night\01 Gasoline.wma.

I saw both of those sites you told me to go into and I have no idea what to
use out of those sites.
 
D

Douglas J. Steele

For the solution from the Access Web, you'd copy everything between Code
Start and Code End and paste it into a new module (not a class module nor
the module associated with a form). When you save the module, make sure you
don't name it the same as any of the routines within the module. To play a
file, you'd then call the fPlayStuff function (passing it the full path to
the file, and, optionally, one of the 5 constants at the start of the code
as how to play the file) to start playing. If you passed pcsLoop as the
instruction, you'd need to call fStopStuff to stop it from playing.

For the solution from my column, copy the module mdlPlayMP3 from the sample
database. To play a file, you'd call the PlayMP3 function that's in that
module.

To be honest, I haven't worked with WMA files, but I suspect the PlayMP3
function will work. You'll likely have to go into the function, though, and
change

strCommand = "open " & strShortPathAndFile & " Type MPEGVideo Alias MyMP3"

to

strCommand = "open " & strShortPathAndFile & " Type WindowsMediaAudio Alias
MyMP3"
 
Top