The error occurs on the following line:
VB Code:
  1. For x = 0 To File1.ListCount - 1

Here's the code:
VB Code:
  1. Private Sub Command2_Click()
  2. 'Dim stuff here
  3. Dim x As Integer
  4. Dim table As String
  5. Dim fname As String
  6. Dim strFilepath As String, strFileName As String, _
  7. strFileSize As String, strArtist As String, _
  8. strTitle As String, strAlbum As String, strTrack As String, _
  9. strFrequency As String, strBitrate As String, _
  10. strLength As String
  11.  
  12.  
  13. 'add the new category to the listbox
  14. lstCategories.AddItem txtcategory.Text
  15.  
  16. 'Create a new table in the Database for the category
  17. Call ADOCreateTable
  18.  
  19. 'connect to the database
  20. Dim Cnn As ADODB.Connection
  21. Dim SQL As String
  22. Set Cnn = New ADODB.Connection
  23. Cnn.Open ConnectionString:="Provider=Microsoft.Jet.OLEDB.4.0;" & _
  24.       "Data Source= c:\windows\system\kamo.mdb;"
  25.  
  26. 'set table = to the category added
  27. table = txtcategory.Text
  28.  
  29. 'Loop through the filelistbox getting info on the files
  30. For x = 0 To File1.ListCount - 1
  31.     fname = File1.Path & "\" & File1.List(x)
  32.     ReadMP3 fname, True, True
  33.    
  34. 'Store the info as strings
  35.     strFilepath = fname
  36.     strFileName = File1.List(x)
  37.     strFileSize = FileLen(fname)
  38.     strArtist = GetMP3Info.Artist
  39.     strTitle = GetMP3Info.Songname
  40.     strAlbum = GetMP3Info.Album
  41.     strTrack = GetMP3Info.Track
  42.     strFrequency = GetMP3Info.Frequency
  43.     strBitrate = GetMP3Info.bitrate
  44.     strLength = GetMP3Info.Duration
  45.    
  46.    
  47. 'Use SQL to insert the information in the strings into the table
  48. SQL = "INSERT into Table (Filepath,Filename,Filesize,Artist, _
  49. Title,Album,Frequency,Bitrate,Length,Track#) _
  50. VALUES ('" & strFilepath & "','" & strFileName & "', _
  51. '" & strFileSize & "','" & strArtist & "','" & strTitle & "', _
  52. '" & strAlbum & "','" & strTrack & "','" & strFrequency & "', _
  53. '" & strBitrate & "','" & strLength & "')"
  54. Cnn.Execute SQL
  55.  
  56. Next
  57.  
  58.  
  59. 'Update the combocategory on the main form
  60. Call WriteTextFile
  61.  
  62. End Sub