title: Overflow error after inserting only a few rows from Excel
body: <p>I'm attempting to set up a copy of the database onto an excel document that sales reps can update while they are out in the field. I've got the code for an insert statement to be run for the list rows, but I get an Overflow error after only 20 lines. Here is my code:</p>
  
  <pre><code>Sub ConnectTODB()
  
    Dim CustomersConn As ADODB.Connection
    Dim CustomersCmd As ADODB.Command
    Dim lo As Excel.ListObject
    Dim ws As Excel.Worksheet
    Dim lr As Excel.ListRow
  
    Set ws = ThisWorkbook.Worksheets(8)
    Set lo = ws.ListObjects("TCustomers")
  
    Set CustomersConn = New ADODB.Connection
    Set CustomersCmd = New ADODB.Command
  
    CustomersConn.ConnectionString = SQLConStr
    CustomersConn.Open
    CustomersCmd.ActiveConnection = CustomersConn
  
    For Each lr In lo.ListRows
      CustomersCmd.CommandText = _
      GetInsertText( _
      Intersect(lr.Range, lo.ListColumns("Type").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Customer").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Name").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Contact").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Email").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Phone").Range).Value, _
      Intersect(lr.Range, lo.ListColumns("Corp").Range).Value)
  
      CustomersCmd.Execute
    Next lr
  
    CustomersConn.Close
  
    Set CustomersConn = Nothing
  
  End Sub
  
  Function GetInsertText(CType As String, Customer As Integer, Name As String, Contact As String, Email As String, Phone As String, Corp As String) As String
    Dim SQLStr As String
  
    SQLStr = _
    "INSERT INTO Customer (" &amp; _
    "Type, Customer,Name,Contact,Email,Phone,Corp)" &amp; _
    "VALUES (" &amp; _
    "'" &amp; CType &amp; "'," &amp; _
    "'" &amp; Customer &amp; "'," &amp; _
    "'" &amp; Name &amp; "'," &amp; _
    "'" &amp; Contact &amp; "'," &amp; _
    "'" &amp; Email &amp; "'," &amp; _
    "'" &amp; Phone &amp; "'," &amp; _
    "'" &amp; Corp &amp; "')"
  
    GetInsertText = SQLStr
  
  End Function
  </code></pre>
  
  <p>The total table size is only 1600 rows, so I wasn't expecting an overflow error.
  Any help would be appreciated! </p>