Runtime error 3705, operation is not allowed when object is open
<p>I am getting error 3705 after adding the line </p>

<pre><code>[MTSU_Data].[Tool no]=" CInt(WsInput.Range("J" &amp; c).value) &amp; ";"
</code></pre>

<p>The highlighted line where the error occurs is at </p>

<pre><code>.ActiveConnection = conn
</code></pre>

<p>Full code</p>

<pre><code>Dim conn As ADODB.Connection
Dim Accdata As ADODB.Recordset
Dim Accfield As ADODB.Field
Dim wsQueryR As Worksheet, wsFinal As Worksheet

Set wsFinal = Worksheets("Final")
Set conn = New ADODB.Connection
Set Accdata = New ADODB.Recordset

conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\wongki7\Desktop\MTSU Db.accdb;"
conn.Open
'G:\BusUnits\MTSU\MTSU\Mold Tool Set Up\MTSU  Reports\Shift Reports\MTSU Db.accdb;"
' On Error GoTo CloseConnection

  For c = 2 To WsInput.Range("J" &amp; Rows.Count).End(xlUp).Row
    With Accdata
      .ActiveConnection = conn
      .Source = "SELECT * FROM [MTSU_Data] Where [MTSU_Data].[Date]&gt;= #" _
            &amp; Format(CDate(WsInput.Range("A2").value), "mm/dd/yyyy") &amp; " # AND [MTSU_Data].[Date]&lt;= #" _
            &amp; Format(CDate(WsInput.Range("A3").value), "mm/dd/yyyy") &amp; " # AND [MTSU_Data].[LT] = " _
            &amp; CInt(WsInput.Range("M2").value) &amp; " AND [MTSU_Data].[Tool no]=" _
            &amp; CInt(WsInput.Range("J" &amp; c).value) &amp; ";"
      .LockType = adLockReadOnly
      '.CursorType = adOpenForwardOnly
      .Open
    End With
  Next
  Worksheets("Result").Select
  Sheets("Result").Range("a2").CopyFromRecordset Accdata
  Accdata.Close
  conn.Close
</code></pre>

<p>Any help is appreciated. Thanks and have a good day ahead.</p>