Find next record according to specific criteria

  • Thread starter Thread starter eda
  • Start date Start date
E

eda

I have a field on a form that has a checkbox. I want to make a button
that will go to the next record that doesn't have the checkbox checked
(I don't want to filter the records, just to advance to the next
unchecked record). What code do I use to accomplish this?
 
You can use the FindNext method to do that:

With Me.RecordsetClone
.FindNext "[CheckBoxFieldName] = 0"
If .NoMatch Then
MsgBox "No More UnChecked Records"
Else
Me.Bookmark = .Bookmark
End If
End With

Note CheckBoxFieldName is the name of the field in the recordset, not the
name of the check box control on the form.
 
Your code worked like a charm! Thanks!!!

You can use the FindNext method to do that:

With Me.RecordsetClone
.FindNext "[CheckBoxFieldName] = 0"
If .NoMatch Then
MsgBox "No More UnChecked Records"
Else
Me.Bookmark = .Bookmark
End If
End With

Note CheckBoxFieldName is the name of the field in the recordset, not the
name of the check box control on the form.
--
Dave Hargis, Microsoft Access MVP



eda said:
I have a field on a form that has a checkbox. I want to make a button
that will go to the next record that doesn't have the checkbox checked
(I don't want to filter the records, just to advance to the next
unchecked record). What code do I use to accomplish this?- Hide quoted text -

- Show quoted text -
 
Glad I could help.
--
Dave Hargis, Microsoft Access MVP


eda said:
Your code worked like a charm! Thanks!!!

You can use the FindNext method to do that:

With Me.RecordsetClone
.FindNext "[CheckBoxFieldName] = 0"
If .NoMatch Then
MsgBox "No More UnChecked Records"
Else
Me.Bookmark = .Bookmark
End If
End With

Note CheckBoxFieldName is the name of the field in the recordset, not the
name of the check box control on the form.
--
Dave Hargis, Microsoft Access MVP



eda said:
I have a field on a form that has a checkbox. I want to make a button
that will go to the next record that doesn't have the checkbox checked
(I don't want to filter the records, just to advance to the next
unchecked record). What code do I use to accomplish this?- Hide quoted text -

- Show quoted text -
 
Back
Top