Find Next

  • Thread starter Thread starter Christopher Danello
  • Start date Start date
C

Christopher Danello

I have a combo box in my form which is used to retrive
specific records. I have it pertaining to names. This
works great unless the name is common; smith, jones, etc.

The problem is that the combo box only pulls the first
record with that name. In attempting to create a "Find
Next" command button, I couldn't find any way to link it
to the combo box. Creating a "Go to next record" button
was equally unsuccessful.

I did make the combo box sort to ascending order, so I can
scroll down to the other Smith, Jones, Etc., records.
However a button would be more efficient. Does anyone
know if that can be done?
 
I use a filter rather than find next for that kind of
thing.

Me.FilterOn = False
Me.Filter = "[LastName] = '" & Me![cboLastName] & "'"
Me.FilterOn = True
 
Hi Christopher,

This should work for you in a command button:

Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
rs.FindNext "[FieldName] = '" & cboName & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "No other matches found"
End If
rs.Close
Set rs = Nothing

just change FieldName & cboName to the correct names of your field and combo

HTH
Steve C
 
Back
Top