Question 1:
My Access File is Adding All my Courses that Contain More than 1 of into 1 Database File.

Example:

I have ICS4M1-01 4 Times in a File

It creates the new Database File (ICS4M1-01.mdb) & then suppose to add just 1 to Information but instead it will add 3 others to it, all with the same information.

How can I fix this?

The Code for all of it is below.
vb Code:
  1. Option Strict On
  2. Imports System.Data.OleDb
  3. Imports System.IO
  4. Module modImport
  5.     Public Sub ImportCourse()
  6.         With frmCourses
  7.             If .ofdOpen.ShowDialog = DialogResult.OK Then
  8.                 Dim FileCopyName As String = Application.StartupPath & "\Data\Courses\" & Path.GetFileName(.ofdOpen.FileName.Remove(.ofdOpen.FileName.LastIndexOf("."))) & ".CSV"
  9.                 If File.Exists(FileCopyName) = True Then
  10.                     File.Delete(FileCopyName) 'Temp
  11.                 Else
  12.                     File.Copy(.ofdOpen.FileName, FileCopyName)
  13.                     SQL = "SELECT * FROM " & .ofdOpen.FileName
  14.                     Dim Path As String = IO.Path.GetFullPath(.ofdOpen.FileName.Remove(.ofdOpen.FileName.LastIndexOf("\")))
  15.                     Connection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path & ";Extended Properties=""text;HDR=Yes;FMT=Delimited"";")
  16.                     Command = New OleDbCommand(SQL, Connection)
  17.                     Command.Connection.Open()
  18.                     Adapter.SelectCommand = Command
  19.                     DS = New DataSet
  20.                     Adapter.Fill(DS)
  21.                     Command.Connection.Close()
  22.                     Application.DoEvents()
  23.                     If bImportCancel = False Then
  24.                         For Each DRow As DataRow In DS.Tables(0).Rows
  25.                             If .lstCourses.Items.Contains(DRow("Classes(Import If #1)")) = False Then
  26.                                 frmImport.Show()
  27.                                 Connection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Data\Courses\" & DRow("Classes(Import If #1)").ToString() & ".mdb")
  28.                                 CreateCourse(Connection.ConnectionString)
  29.                                 SQL = "INSERT INTO [Information] (CourseCode, RoomNumber) VALUES (?, ?);"
  30.                                 Command = New OleDbCommand(SQL, Connection)
  31.                                 Command.Connection.Open()
  32.                                 Command.Parameters.AddWithValue("CourseCode", DRow("Classes(Import If #1)"))
  33.                                 Command.Parameters.AddWithValue("RoomNumber", DRow("Home Room/Form"))
  34.                                 Command.ExecuteNonQuery()
  35.                                 Connection.Close()
  36.                                 frmImport.pbImport.Maximum = DS.Tables(0).Rows.Count
  37.                                 If frmImport.pbImport.Value > DS.Tables(0).Rows.Count + 5 Then
  38.                                     frmImport.pbImport.Value = frmImport.pbImport.Maximum
  39.                                     File.Delete(FileCopyName)
  40.                                     frmImport.Close()
  41.                                     MessageBox.Show("Import Complete")
  42.                                 Else
  43.                                     frmImport.pbImport.Increment(5)
  44.                                 End If
  45.                             End If
  46.                         Next
  47.                         MsgBox("Done")
  48.                     End If
  49.                 End If
  50.             End If
  51.         End With
  52.     End Sub
  53. End Module

Question 2:
My Progress Bar doesn't really work. I want it to increment while reading from the list and each time it reads one line of the file I want it to + 1 to the Value, and then once it reaches the End I want it to say Done, like in MsgBox("Done") but frankly, it doesn't, how would I go about incrementing to the process of reading line by line ?