I have 2 buttons on a main form that select or deselect multiple check boxes on a subform.
The reason is when a user selects from a combo box it could populate the subform with 100's of records. I want the user to be able to reset his selection if he made a mistake after selecting all of the check boxes with the first button.
Works fine when selecting all of the chkboxes but when i try to deselect it does nothing until I exit the form and come back in then I am able to deselect.
Am i missing something here. It seems like I am stuck in a loop or not closing something properly.
Below is the code
The reason is when a user selects from a combo box it could populate the subform with 100's of records. I want the user to be able to reset his selection if he made a mistake after selecting all of the check boxes with the first button.
Works fine when selecting all of the chkboxes but when i try to deselect it does nothing until I exit the form and come back in then I am able to deselect.
Am i missing something here. It seems like I am stuck in a loop or not closing something properly.
Below is the code
Code:
Private Sub cmdAll_Click()
Dim rs As DAO.Recordset
Set rs = Forms!frmEquipmentRemoveGroup!sbfEquipmentRemoveGroup.Form.RecordsetClone
Do While Not rs.EOF
If rs.RecordCount = 0 Then
Exit Do
End If
rs.Edit
rs!EquipActive = True
rs.Update
rs.MoveNext
Loop
Forms!frmEquipmentRemoveGroup.sbfEquipmentRemoveGroup.Form.Requery
rs.Close
Set rs = Nothing
Exit Sub
End Sub[/EndCode]
[Code]
Private Sub cmdAllReset_Click()
Dim rst As DAO.Recordset
Set rst = Forms!frmEquipmentRemoveGroup!sbfEquipmentRemoveGroup.Form.RecordsetClone
Do While Not rst.EOF
If rst.RecordCount = 0 Then
Exit Do
End If
rst.Edit
rst!EquipActive = False
rst.Update
rst.MoveNext
Loop
Forms!frmEquipmentRemoveGroup.sbfEquipmentRemoveGroup.Form.Requery
rst.Close
Set rst = Nothing
Exit Sub
End Sub[/EndCode]
Thank You