1st Time in Access Forum - Need Help with File Search

kevin.philips

Active Member
Joined
Jan 7, 2003
Messages
364
Hi,

I have borrowed the code below from the Excel forum, how do I adapt it so that whenever I open my database it will run the macro.... I can do without displaying it on a form but would like the results displayed in a table - just the artist and song title will do.

Please help

Regards

Kevin

Doh:


Code:
Option Explicit
Public Type mp3Info
    Header As String * 3
    Title As String * 30
    Artist  As String * 30
    Album  As String * 30
    Year  As String * 4
    Comment As String * 30
    Genre  As Byte
End Type

Sub Getmp3Info()
    Dim mp3ID As mp3Info
    Dim lngRow As Long, lngFile As Long
    Dim lngFileCnt As Long
    With Application.FileSearch
        .NewSearch
        .Filename = "*.MP3"
        .LookIn = "C:\Documents and Settings\Kevin Philips\My Documents\My Music\Mp3"  'Change this to the folder you wish to search
        .SearchSubFolders = True
        .Execute
        For lngFileCnt = 1 To .FoundFiles.Count
            lngFile = FreeFile
            Open .FoundFiles(lngFileCnt) For Binary As lngFile
            Get lngFile, LOF(1) - 127, mp3ID
            Close lngFile
            If mp3ID.Header = "TAG" Then
                ActiveCell.Offset(lngRow, 0) = .FoundFiles(lngFileCnt)
                With mp3ID
                    ActiveCell.Offset(lngRow, 1) = .Title
                    ActiveCell.Offset(lngRow, 2) = .Artist
                    ActiveCell.Offset(lngRow, 3) = .Album
                    ActiveCell.Offset(lngRow, 4) = .Year
                    ActiveCell.Offset(lngRow, 5) = .Genre
                    ActiveCell.Offset(lngRow, 6) = .Comment
                End With
                lngRow = lngRow + 1
            End If
        Next
    End With
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,221,537
Messages
6,160,401
Members
451,645
Latest member
hglymph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top