I'll make it short:
what would I have to do so that the code exits the loop?
NOTE: Table1 has no primary key.
Code:
Dim ID as Long
Dim rst as DAO.Recordset
Set rst = CurrentDB.OpenRecorset("SELECT GroupID, SUM(Val) As ValSum FROM Table1 Order By SUM (Val) ASC Group By GroupID")
rst.MoveFirst
ID = rst.Fields(0)
Do while ID = rst.Fields(0)
CurrentDB.Execuet("INSERT INTO Table1 (GroupID, Val) VALUES (" & ID & ", 1)")
rst.Requery()' Chnge value of first rst?...
Loop
'next line of code...
NOTE: Table1 has no primary key.