Private Sub Command2_Click()
'Dim stuff here
Dim x As Integer
Dim table As String
Dim fname As String
Dim strFilepath As String, strFileName As String, _
strFileSize As String, strArtist As String, _
strTitle As String, strAlbum As String, strTrack As String, _
strFrequency As String, strBitrate As String, _
strLength As String
'add the new category to the listbox
lstCategories.AddItem txtcategory.Text
'Create a new table in the Database for the category
Call ADOCreateTable
'connect to the database
Dim Cnn As ADODB.Connection
Dim SQL As String
Set Cnn = New ADODB.Connection
Cnn.Open ConnectionString:="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= c:\windows\system\kamo.mdb;"
'set table = to the category added
table = txtcategory.Text
'Loop through the filelistbox getting info on the files
For x = 0 To File1.ListCount - 1
fname = File1.Path & "\" & File1.List(x)
ReadMP3 fname, True, True
'Store the info as strings
strFilepath = fname
strFileName = File1.List(x)
strFileSize = FileLen(fname)
strArtist = GetMP3Info.Artist
strTitle = GetMP3Info.Songname
strAlbum = GetMP3Info.Album
strTrack = GetMP3Info.Track
strFrequency = GetMP3Info.Frequency
strBitrate = GetMP3Info.bitrate
strLength = GetMP3Info.Duration
'Use SQL to insert the information in the strings into the table
SQL = "INSERT into Table (Filepath,Filename,Filesize,Artist, _
Title,Album,Frequency,Bitrate,Length,Track#) _
VALUES ('" & strFilepath & "','" & strFileName & "', _
'" & strFileSize & "','" & strArtist & "','" & strTitle & "', _
'" & strAlbum & "','" & strTrack & "','" & strFrequency & "', _
'" & strBitrate & "','" & strLength & "')"
Cnn.Execute SQL
Next
'Update the combocategory on the main form
Call WriteTextFile
End Sub