Alright, Here's what is happening:

I have a .MDB File that gets created and inserted with DATA. I then have the CONNECTION.CLOSE, but then say I go to Delete It, it says that it is being used already, I check my Process and doesn't show anything. This only happens in the first 5 Seconds after creating and trying to delete, after the 5 seconds, it will work normal. I know this sounds weird, but how can I make it to not be used in the process right after Connection.Close is Called?

Here's my Code:

vb Code:
  1. Public Function CreateCourse(ByVal DBDirectory As String) As Boolean
  2.         Dim DB As New ADOX.Catalog()
  3.         Try
  4.             Application.DoEvents()
  5.             With frmNewEditCourse
  6.                 DB.Create(Connection.ConnectionString)
  7.                 SQL = "CREATE TABLE [Information] ([CIndex] AutoIncrement, [CourseCode] TEXT, [RoomNumber] TEXT, [CourseYear] TEXT, [Teacher] Text)"
  8.                 Command = New OleDbCommand(SQL, Connection)
  9.                 Command.Connection.Open()
  10.                 Command.ExecuteNonQuery()
  11.                 SQL = "CREATE TABLE [Students] ([CIndex] AutoIncrement, [LastName] TEXT, [FirstName] TEXT)"
  12.                 Command = New OleDbCommand(SQL, Connection)
  13.                 Command.ExecuteNonQuery()
  14.                 SQL = "CREATE TABLE [Events] ([CIndex] AutoIncrement, [Date (D/M/Y)] TEXT, [EventTitle] TEXT, [EventDesc] TEXT)"
  15.                 Command = New OleDbCommand(SQL, Connection)
  16.                 Command.ExecuteNonQuery()
  17.                 Command.Connection.Close()
  18.                 If bImportCourse = False Then
  19.                     SQL = "INSERT INTO [Information] (CourseCode, RoomNumber, CourseYear, Teacher) VALUES (?, ?, ?, ?); "
  20.                     Command = New OleDbCommand(SQL, Connection)
  21.                     Command.Connection.Open()
  22.                     Command.Parameters.AddWithValue("CourseCode", .txtCourseCode.Text)
  23.                     Command.Parameters.AddWithValue("RoomNumber", .txtRoomNumber.Text)
  24.                     Command.Parameters.AddWithValue("CourseYear", .txtCourseYear.Text)
  25.                     Command.Parameters.AddWithValue("Teacher", .txtTeacher.Text)
  26.                     Command.ExecuteNonQuery()
  27.                     Command.Connection.Close()
  28.                     frmStartup.lstCourses.Items.Add(.txtCourseCode.Text)
  29.                 End If
  30.             End With
  31.         Catch Excep As System.Runtime.InteropServices.COMException
  32.         Finally
  33.             DB = Nothing
  34.         End Try
  35.     End Function