title: Code Skipping Over Recordset Input, ADODB Excel VBA
body: <p>Today has been a YouTube and Internet scouring day, and I haven't quite figured out how to get this code to work. It opens and closes the connection without trouble but when I try to write to a recordset it completely skips over everything and closes the connection without inputting any Data. </p>
  
  <pre><code>Const AccessConnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Vision\Database\BVAS.accdb;Persist Security Info=False;"
  
  Private Sub BtnSave_Click()
  
      Dim DbConn As ADODB.Connection
      Dim Inventory As ADODB.Recordset
      Dim r As Range
  
      Set DbConn = New ADODB.Connection
      Set Inventory = New ADODB.Recordset
  
      DbConn.ConnectionString = AccessConnStr
      DbConn.Open
         On Error GoTo CloseConnection
          With Inventory
              .ActiveConnection = DbConn
              .Source = "T3Scaffold_Inventory"
              .LockType = adLockOptimistic
              .CursorType = adOpenKeyset
              .Open
              On Error GoTo CloseRecordset
          End With
              CountSheet.Activate
                  'WTF, why does it skip this ? Research if and IF or Do WHILE statement will work here for so that only the Items with quantity &gt;0 are sent to ACCESS
                      For Each r In .Range("A2", Range("A2").End(xlDown))
  
                              With Inventory
                                  .AddNew
                                  .Fields("ScaffoldID") = Range("ScaffoldID")
                                  .Fields("ItemNumber") = Cells(i + 1, 1).Value
                                  .Fields("Quantity") = Cells(i + 1, 3).Value
                                  .Fields("WorktypeID") = Range("WorktypeID")
                                  .Fields("RentStartDate") = Range("Date")
                                  .Fields("OnRent?") = "Yes"
                                  .Update
                              End With
  
                      Next r
  
  
  CloseRecordset:
      Inventory.CancelUpdate
      Inventory.Close
  
  CloseConnection:
      DbConn.Close
  
  Set Inventory = Nothing
  Set DbConn = Nothing
  
  
  End Sub
  </code></pre>
  
  <p>Thanks Everyone. I hope that this is a super complicated solution lol.
  -MC</p>