title: Excel VBA Access
body: <p>I have the following code, where .Fields... is not getting executed. Loop is directly closing the connection without adding records into table.</p>
  
  <p>Code:</p>
  
  <pre><code>Sub insertIntoTable()
  
      Dim moviesConn As ADODB.Connection
      Dim moviesData As ADODB.Recordset
      Dim moviesField As ADODB.Fields
      Dim r As Range
  
      Set moviesConn = New ADODB.Connection
      Set moviesData = New ADODB.Recordset
  
      moviesConn.ConnectionString = conStrAccess
      moviesConn.Open
  
      On Error GoTo closeConnection
  
      With moviesData
          .ActiveConnection = moviesConn
          .Source = "tblFilmDetails"
          .LockType = adLockOptimistic
          .CursorType = adOpenForwardOnly
          .Open
  
      On Error GoTo closeRecordset
          For Each r In Range("A3", Range("A2").End(xlDown))
              .AddNew
              .Fields("Title").Value = r.Offset(0, 1).Value
              .Fields("Release_Date").Value = r.Offset(0, 2).Value
              .Fields("Length").Value = r.Offset(0, 3).Value
              .Fields("Genere").Value = r.Offset(0, 4).Value
              .Update
          Next r
      End With
  
      closeRecordset:
      moviesData.Close
  
      closeConnection:
      moviesConn.Close
  
  End Sub
  </code></pre>
  
  <p>Please suggest</p>