step back through previous Find results

madwoman

Registered User.
Local time
Today, 05:13
Joined
Oct 20, 2005
Messages
20
Hi
I have a set of membership records which have data input via a simple form. When looking for a particular record I use the standard Find menu item on the whole record set from the Form view, and move through the results using the Find Next button. Is there a way to move back through the records when I have got to the end of the results. eg. there may be numerous members with a surname Smith and I can move the the Smith records by using Find and Find Next but if I have moved past the record that I want is there a way of stepping back through the records?
Apologies if this is a really obvious question
 
Use Bookmark property.

Let's say you do three Finds. You will want to save three separate bookmarks:

Code:
Dim BookMark1 As Integer 'I think the position is integer; I may be wrong.
Dim BookMark2 As Integer
Dim BookMark3 As Integer

...
FindFirst(Something)
BookMark1= Me.BookMark
...
FindNext(Something)
BookMark2 = Me.BookMark
...
FindNext(Something)
BookMark3 = Me.BookMark
....
End Sub

Private Sub btnBack_Click

If Not IsNull(BookMark3) Then
   Me.Bookmark = BooKMark3
Elseif Not IsNull(BookMark2) Then
   Me.Bookmark = BookMark2
Elseif Not IsNull(BookMark1) Then
   Me.Bookmark = BookMark1
Else
   Msgbox("No Previous Record")
End If

End Sub

This is an air code, and you will have to modify it to check which bookmark it is because what I wrote above will keep going to bookmark3 but is there to give you an idea of what you want to accomplish.

You also can do this with Select Case block instead. To allow for dynamic numbers of bookmarks, Use either concentation or arrays

To make an array:

Code:
Dim i As Integer
Dim MyBookMark As Integer
...
...
Me.BookMark = MyBookMark(i)
i = i + 1

HTH.
 
Thanks, that's a bit above my level of expertise, sorry. I would need to accommodate a dynamic number of finds, but am not sure how to modify the above and generate a script that would sort things out. Is this the only way to resolve this one?
 
Why don't you zip up a sample db and I'll insert code for you when I have time?
 
Many thanks, that would be really helpful.
Attached is a stripped down sample of the database
Ignore the fact that when you go into the Existing Members Form that there is a blank record, if you use CRTL-F on the surname and Find 'smith' you should get a handful. What we need to be able to do is step through the found records (using Find Next) and review them and then step backward through them when you have got to the last oneand make an amendment to one of them.
 

Attachments

Users who are viewing this thread

Back
Top Bottom