title: access 2007 vba recordset.EOF loop returning back first record of set
body: <p>So I am trying to select some data from a table and then loop through the results and insert new records with modified/additional data into the table. the problem I am having is that when i loop through my recordset It seems to go through the whole set and then back to the first set before exiting. </p>
  
  <p>An example is that I have two records in the table and when I make the selection it should insert only two records but for some reason it inserts 3, the first one repeating twice</p>
  
  <p>Here is my code.</p>
  
  <pre><code>Dim rs1 As DAO.Recordset
  Dim query1 As String
  query1 = "select [Test Script] from TEST_SCRIPTS where TEST_ID= " &amp; Me.TEST_ID &amp; " "
  
  Set rs1 = CurrentDb.OpenRecordset(query1)
  
  If Not (rs1.EOF And rs1.BOF) Then
  
      rs1.MoveFirst
      Do Until rs1.EOF = True
  
           INSERT_INTO_TEST_SCRIPTS = "insert into TEST_SCRIPTS ([Test Script], TEST_ID) values (""" &amp; rs1![Test Script] &amp; """, " &amp; Me.TEST_ID &amp; ") "
  
              DoCmd.SetWarnings False
                  DoCmd.RunSQL INSERT_INTO_TEST_SCRIPTS
              DoCmd.SetWarnings True
  
          rs1.MoveNext
  
      Loop
  End If
  
  rs1.Close
  Set rs1 = Nothing
  </code></pre>
  
  <p>I am new to working with recordsets and this one has been bothering me, I appreciate any help.</p>
  
  <p>thanks</p>