Find next record according to specific criteria

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?
 
G

Guest

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.
 
E

eda

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 -
 
G

Guest

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 -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top