Update of MP3 Tags in Access

393 Views Asked by At

Hello everyone I attempted to run the following code to input the MP3 Tags from the MP3Properties table into the Tracks in a folder and upon doing so I receive the following error Compile error: Function call on left-hand side of assignment must return variant or object in the SetID3Tag function: How can I fix this issue? Thanks

Dim RS As DAO.Recordset

    Set RS = CurrentDb.OpenRecordset("SELECT * FROM MP3Properties")

    If Not (RS.EOF And RS.BOF) Then
        RS.MoveFirst
        Do Until RS.EOF = True


    Dim Tag As ID3Tag
    Tag.Header = "TAG"

    Tag.SongTitle = RS!Title
    Tag.Album = RS!Album
    Tag.Genre = RS!Genre
    Tag.Artist = RS!Artist
    Tag.Year = RS!Year

    Call SetID3Tag(Forms![UpdateMp3]![Text2], Tag)

            'Call SetID3Tag(Forms![UpdateMp3]![Text2], ((RS!Album)))
            'Call SetID3Tag(Forms![UpdateMp3]![Text2], ((RS!Title)))
            'Call SetID3Tag(Forms![UpdateMp3]![Text2], ((RS!Genre)))
            'Call SetID3Tag(Forms![UpdateMp3]![Text2], ((RS!Name)))
            'Call SetID3Tag(Forms![UpdateMp3]![Text2], ((RS![Album Artist])))
            RS.MoveNext
        Loop
    Else
        MsgBox "There are no records in the recordset."
    End If



    RS.Close
    Set RS = Nothing


     'Dim TblCnt As Long
    'TblCnt = DCount("*", "MP3Properties")


    'Call GetID3Tag(Forms![UpdateMp3]![Text2], 237)
    'Call SetID3Tag(Forms![UpdateMp3]![Text2], 237)

Public Function SetID3Tag(ByVal filename As String, Tag As ID3Tag) As Boolean

On Error GoTo SetID3TagError

Dim FileNum As Long

    If Dir(filename) = "" Then
        SetID3Tag = False
        Exit Function
    End If

    Tag.Header = "TAG"

    FileNum = FreeFile

    Open filename For Binary As FileNum
    Put FileNum, LOF(1) - 128, Tag
    Close FileNum

    SetID3TagDirect = True

    Exit Function

SetID3TagError:
    Close FileNum
    SetID3Tag = False
End Function

Public Function SetID3TagDirect(ByVal filename As String, _
ByVal Artist_30 As String, ByVal SongTitle_30 As String, _
ByVal Album_30 As String, ByVal Comment_30 As String, _
ByVal Year_4 As String, ByVal Genre_B255 As Byte) As Boolean
Dim Tag As ID3Tag
'Debug.Print MyModule
On Error GoTo SetID3TagDirectError

Dim FileNum As Long

    If Dir(filename) = "" Then
        SetID3TagDirect = False
        Exit Function
    End If

    Tag.Header = "TAG"
    Tag.Artist = Artist_30
    Tag.SongTitle = SongTitle_30
    Tag.Album = Album_30
    Tag.Comment = Comment_30
    Tag.Year = Year_4
    Tag.Genre = Genre_B255

    FileNum = FreeFile

    Open filename For Binary As FileNum
    Put FileNum, LOF(1) - 127, Tag
    Close FileNum

    SetID3TagDirect = True

    Exit Function

SetID3TagDirectError:
    Close FileNum
    SetID3TagDirect = False
End Function
0

There are 0 best solutions below