missinglinq
Programmer
Been so long since I asked a question, took me 5 minutes to find the 'new thread' place!
This works to tick CheckboxField on all records of a form:
And this works to untick CheckboxField on all records of a form:
But you can only do one of these operations unless you close then re-open the Form. In other words you cannot 'tick all' and then immediately 'untick all.' I thought that
rs.Close
Set rs = Nothing
would allow the RecordsetClone to be recreated again, but apparently not.
The Missinglinq
Richmond, Virginia
The Devil's in the Details!
This works to tick CheckboxField on all records of a form:
Code:
Private Sub cmdTickAllBoxes_Click()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
With rs
Do While Not rs.EOF
rs.Edit
rs!CheckboxField = -1
rs.Update
rs.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
Me.Requery
End Sub
Code:
Private Sub cmdUntickAllBoxes_Click()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
With rs
Do While Not rs.EOF
rs.Edit
rs!CheckboxField = 0
rs.Update
rs.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
Me.Requery
End Sub
But you can only do one of these operations unless you close then re-open the Form. In other words you cannot 'tick all' and then immediately 'untick all.' I thought that
rs.Close
Set rs = Nothing
would allow the RecordsetClone to be recreated again, but apparently not.
The Missinglinq
Richmond, Virginia
The Devil's in the Details!