Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess 2007 VBA Record Set Infinite Loop
    text
    copied!<p>So I am doing a query that when you click a button it takes a record set with an unassigned field of data and copies that recordset into the same table with a new "assigned version". </p> <p>I want my database to be able to make different/multiple "assigned versions" from the original unassigned set, and this works great when i create the first assigned set, but when i try to create a new assigned set it goes into a loop that seems completely random, it could create new entries from 10-1000 and i dont know what is causing this.</p> <p>Sorry if this was confusing, looking at the code will probably help more</p> <p>thanks!</p> <pre><code>Dim rs1 As DAO.Recordset Dim unionquery As String Dim CURRENT_SOFTWARE_VERSION As String CURRENT_SOFTWARE_VERSION = Me.Parent.[Software Version].Value initialquery = "select [Test Script] , [PROC_CHECK_ID], [Software Version] from (FORMAL_CERT_PROCEDURE_TEST_SCRIPTS inner join FORMAL_CERT_PROCEDURE_CHECK on FORMAL_CERT_PROCEDURE_TEST_SCRIPTS.TEST_CASE_ID = FORMAL_CERT_PROCEDURE_CHECK.TEST_CASE_ID) inner join FORMAL_CERT_SOFTWARE_VERSION on FORMAL_CERT_PROCEDURE_TEST_SCRIPTS.TEST_CASE_ID = FORMAL_CERT_SOFTWARE_VERSION.TEST_CASE_ID where PROC_CHECK_ID=" &amp; Me.PROC_CHECK_ID &amp; " AND [Software Version]=""" &amp; CURRENT_SOFTWARE_VERSION &amp; """ " Set rs1 = CurrentDb.OpenRecordset(initialquery, dbOpenForwardOnly) Do Until rs1.EOF = True Dim rs2 As DAO.Recordset Set rs2 = CurrentDb.OpenRecordset( _ "SELECT * FROM FORMAL_CERT_PROCEDURE_TEST_SCRIPTS", _ dbOpenDynaset) rs2.AddNew rs2![Test Script] = rs1![Test Script] rs2![PROC_CHECK_ID_FK] = rs1!PROC_CHECK_ID rs2![Software_Version] = rs1![Software Version].Value rs2![TEST_CASE_ID] = Me.TEST_CASE_ID rs2.Update rs2.Close Set rs2 = Nothing rs1.MoveNext Loop </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload