Winamp and Access

IT WORKS!!
smile.gif


My MP3 database can now update TAG info from my tables into an MP3 file (or multiple files). It can also read TAG info from MP3 files into a table as well.

All thanks to jatfill!
 
I'm a newbie in access, and i would like to know how can you get jatfill's code to work in an database.I'm mostly interested in reading tag info and then store them in a database.Thanks alot guys!!!!!!

[This message has been edited by takis_x (edited 05-31-2002).]

[This message has been edited by takis_x (edited 05-31-2002).]
 
start with the post on 2/26 and follow the directions given there. If you just want to write existing ID3's to a table then all you should need is the first module for starters.

To write tag data to table fields, use the following code behind a command button or other event:

Code:
Private Sub cmdAddFile_Click()
MP3.FileName = strInputFileName 'get the file

If strInputFileName = "" Then
    Exit Sub
End If

If MP3.isActive = True Then
    'Get ID3 information about MP3: This is just a demonstration
    MsgBox "MP3 Info:" & vbCrLf & vbCrLf & _
        "Title:" & vbTab & MP3.Title & vbCrLf & _
        "Artist:" & vbTab & MP3.Artist & vbCrLf & _
        "Album:" & vbTab & MP3.Album & vbCrLf & _
        "Year:" & vbTab & MP3.Year & vbCrLf & _
        "Genre:" & vbTab & MP3.Genre & vbCrLf & _
        "Comment:" & vbTab & MP3.Comment
Dim nGenre As String
    If MP3.Genre > 147 Then 'Genre information... current support is up to 147, 148 marks as Unknown
        nGenre = "148"
    Else
        nGenre = MP3.Genre
    End If

'Add ID3 Data to table fields    
DoCmd.RunSQL "INSERT INTO tblMusic ( filepath, Tag, Artist, Title, Album, Comment, Year, genreID )" & _
            " SELECT '" & strInputFileName & "' AS tFile, 'TAG' AS tTag, '" & MP3.Artist & "' AS tArtist, '" 
& MP3.Title & "' AS tTitle, '" 
& MP3.Album & "' AS tAlbum, '" 
& MP3.Comment 
& "' AS tComment, '" & MP3.Year & "' AS tYear, '" & _
            nGenre & "' AS tGenre;"
        
End If
End Sub

you'll notice that this code uses the strInputFileName variable, which is the full path to the file you are wanting to add to your table.

That's the basics, post if you you are running into specific problems...

Sad part is, I never even finished my database, but I tried to get far too ambitious with it, I spent quite some time trying to figure out how to drag files into a listbox & have the above event fire off for each file & became a little burned out on the whole thing...

[This message has been edited by jatfill (edited 05-31-2002).]
 
Thanks alot for the code jatfill, you rely saved my life!!!
But i would like to ask a few more things.
How do i put the full path in the code?my folder is named d:\mp3. And can i scan cd's with multiple directories and subdirectories with this code? Sorry if my questions are silly, but as i told you i'm a newbie in ms access and visual basic. Thanks in advance!!!!!!!!
 
I'm trying the above code and I am getting "Invalid object" on this line:

MP3.filename = strinputfilename

Am I missing something?

Thanks!

Vassago
 

Users who are viewing this thread

Back
Top Bottom