raymondchen21
Registered User.
- Local time
- Today, 05:04
- Joined
- Oct 18, 2015
- Messages
- 12
Hi,
I created a navigation form which has several tabs. Each tab has a subform attached to it. When I click on different tabs, different subforms will show. I will want to create a button to check off all boxes in the subform only when it's showing.
I found the following code but when I ran it and it showed me run-time error '7951'. Can anyone please help me with this code? What went wrong or what other code should I use?
Private Sub SelectAll_Click()
Dim rst As DAO.Recordset, i As Integer
Set rst = Me.RecordsetClone
i = 0
rst.MoveFirst
Do While Not rst.EOF
i = i + 1
rst.Edit
If rst![Identified] Then
rst![Identified] = False
Else
rst![Identified] = True
End If
rst.Update
rst.MoveNext
Loop
MsgBox i & " Records Marked."
rst.Close
Set rst = Nothing
End Sub
[Identified] is the name of the checkbox in the subforms.
I created a navigation form which has several tabs. Each tab has a subform attached to it. When I click on different tabs, different subforms will show. I will want to create a button to check off all boxes in the subform only when it's showing.
I found the following code but when I ran it and it showed me run-time error '7951'. Can anyone please help me with this code? What went wrong or what other code should I use?
Private Sub SelectAll_Click()
Dim rst As DAO.Recordset, i As Integer
Set rst = Me.RecordsetClone
i = 0
rst.MoveFirst
Do While Not rst.EOF
i = i + 1
rst.Edit
If rst![Identified] Then
rst![Identified] = False
Else
rst![Identified] = True
End If
rst.Update
rst.MoveNext
Loop
MsgBox i & " Records Marked."
rst.Close
Set rst = Nothing
End Sub
[Identified] is the name of the checkbox in the subforms.