Problem with code for id3

darkmastergyz

Registered User.
Local time
Today, 08:30
Joined
May 7, 2006
Messages
85
I've been searching all over this forum, and I found this really neat link(read from post 17 down):

http://www.access-programmers.co.uk/forums/showthread.php?t=28702&page=2

Which shows how exactly you can get in id3 info from mp3s into a database. But the problem is when I try to use it, I am getting "Invalid object" on this line:

MP3.filename = strinputfilename

Is MP3 supposed to be a function?
 
Last edited:
MP3 is the name of an object. That object is a reference. I haven't looked but it'll be something like this at the top of your function:

Dim MP3 As SomeMediaPlayerName
.
.
.
Set MP3 = New SomeMediaPlayerName

That exposes all of the methods and properties of the referenced object SomeMediaPlayerName. You can try adding a Windows Media Player reference, which exposes that object. I've not tried it, but that'd be the first thing I'd try.
 
That's kind of the problem. I can't find a reference, other than the place I call MP3., to the object.
 
And that's what I said. The name MP3 refers to an object that is a reference. Add the Windows Media Player reference to your DB using References in the code window, and call it MP3, like this:

Dim MP3 As MediaPlayer
.
.
.
Set MP3 = New MediaPlayer

Then go to the immediate window (press Ctrl-G if it's not already open at the bottom) and look at it's methods/properties by typing MP3. and scrolling the IntelliSense stuff.
 
How do you know you need to dim it as MediaPlayer...there are no references to it...
 
Arrgghh!

To quote myself:

"Add the Windows Media Player reference to your DB using References in the code window."

Add the reference. The same way you add an ADO Reference to be able to do this:

Dim rsSomeRecordset As ADODB.Recordset

Without the ADO reference library, it will not know what the hell that is. Add the REFERENCE.

I think you're confusing references and objects. In programming, a reference is NOT the way you refer to something, like your friend is your "bud" or "pal" or "hand". Instead, a reference refers to an external object that is understood by VBA. Once you have those references, the OBJECT that the reference represents is exposed, along with its methods and properties.

Another example (probably more appropriate, but it's too late and I'm tired)...

Think of the reference as a reference library. You've probably been to a library before, or maybe in your house, you have a wall of reference books. These can be encyclopedias, dictionaries, etc. You don't know everything in them -- no one knows that. But when you need some information from them, you reference those books. When you need to know about Ontario, you pull out the "O" encyclopedia and reference that topic. Once you have found it, everything that encyclopedia knows about Ontario is now available to you. (It's now an object, and the methods (customs) and properties (population, size, exports, etc.) are now at your fingertips.)

Once you close that book, you have to go back to it for the exact facts. You have to reference it.

Think of programming that way. (Any C programmer knows what stdio.h is.) Your computer is stupid and can't remember a single thing without you telling it. You have to pull the references each and every time. Once it sees the reference, it remembers everything about it. Once you close the book, it's all gone again and it needs to be reminded.

Sorry if this is too dumbed down or if it makes no sense, but I'm trying to help you see what you are not seeing.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom