大家好,我尝试运行以下代码将 MP3 标记从 MP3Properties 表输入到文件夹中的 Tracks 中,这样做时我收到以下错误编译错误:赋值左侧的函数调用必须返回变量或对象在 SetID3Tag 函数中:如何解决此问题?谢谢
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