Playing an MP3 from Access

I have a database of all my CD’s in Access. I’ve included lyrics and some reviews but one thing I always wanted to do was be able to play a selected song at the click of a button. Once I started ripping all my CD’s this became possible even though it wouldn’t be practical to store all the files in the database itself.

I couldn’t find a VBA command that would make a file open, essentially replicating a double-click in Windows Explorer. But I could make Access follow a hyperlink on the form. So I made an invisible field and had the routine write a hyperlink in there and then had it follow that link.

The code wasn’t too bad, I just had it combine the artist name, a slash, and the song name and tacked “.mp3” on the end (it works unless the song has a ? or : or other such characters which my MP3 ripper converts to _ when writing the file name). Then I had to tack the path to the front including the alphabetical subfolder (for instance “JKL/” for Led Zeppelin).

The problem I had was Access would generate a message that said “It is dangerous to download files from the internet, are you sure you want to open this file?” or something like that. That was annoying. But I found a web site that pointed out that the error was really part of Windows 98 and to fix it you just had to go to Windows Explorer and edit the file associations. Under Tools:Folder Options you click the File Types tab and find MP3 files (which for me were under Winamp files) and then edit that. There is a checkbox that says “Confirm open after download” and if you clear that box, you won’t get the warning anymore.

Works like a charm! And of course it wasn’t too hard to do the same thing with the CD title to play the whole album, tacking “.m3u” on the end of the CD name.

The other problem I ran into was when I reformatted my hard drive and reinstalled all of my software I was getting error messages that didn’t even let the database’s Alpha filter work (letting you just see the L groups for instance instead of scrolling or searching). I don’t know where the conflict came about but I did an installation repair on Office 2000 and it started working again.

One thought on “Playing an MP3 from Access

  1. At some point in a few years, we’ll all have broadband access and ready access to one another’s shares and servers. That’s what I’m doing w/, providing a shared space for text, photos, and music. So there are blogs, galleries, and the directory. My brother can listen to my music and I can listen to my sister’s, and I don’t think the music industry will care. The blogs include photos and sound from the libraries.

    So be thinking about your Access database publishing these links you are building (password protected of course) to your big Bro.

    And you’ll probably enjoy having access to your oldest niece’s library… which of course will run off her graduation present. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *