I have a form with a subform on it. When the user clicks a button, I need it to populate a field on the subform for each record in the subform. I am using a foreign key for the subform which is equal to the primary key on the form. I can get it to work on the first record in the subform using a DO WHILE or IF statement, but it will not advance to the next record. The code I've been fighting with it pasted below. Does anyone have any suggestions?
Do While Forms![Overview]![Subform2]!ID = Forms![Overview]![Subform2]!ID
If Forms![Overview]![Subform2]![SPIN Code].Value <> "COSCU" Then
Forms![Overview]![Subform2]![Signoff].Value = uname
Forms![Overview]![Subform2]![Signoff Date].Value = Date + 1
End If
DoCmd.FindNext
Loop
Do While Forms![Overview]![Subform2]!ID = Forms![Overview]![Subform2]!ID
If Forms![Overview]![Subform2]![SPIN Code].Value <> "COSCU" Then
Forms![Overview]![Subform2]![Signoff].Value = uname
Forms![Overview]![Subform2]![Signoff Date].Value = Date + 1
End If
DoCmd.FindNext
Loop