Hi all,
I have a search text box that sits above a nav form, so when I enter a value in the text box and click the button the value is found in the form.
But how do I continue to search for the same value starting, again, from where the first occurrence has been found in the form.
Ive tried to put a loop in but the code keeps coming back to the first hit.
many thanks for any help please
I have a search text box that sits above a nav form, so when I enter a value in the text box and click the button the value is found in the form.
But how do I continue to search for the same value starting, again, from where the first occurrence has been found in the form.
Ive tried to put a loop in but the code keeps coming back to the first hit.
many thanks for any help please
Code:
Private Sub cmdSearchMenu_Click()
Dim strCriteria As String
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
If IsNull(Me.txtheader_Address) Then
MsgBox "Please enter a value"
ElseIf Me.txtheader_Address <> 0 Then
rst.FindFirst "fldAddress='" & Me!txtheader_Address & "'"
If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark
Me.NavigationSubform.SetFocus
GoToAddress
End If
Set rst = Nothing
End Sub
Private Sub NavigationButton9_Click()
GoToAddress
End Sub
Private Sub GoToAddress()
'move to first record if field is blank
If IsNull(Me.txtheader_Address) Then
'do nothing
Else
With Forms!frmNavigation.NavigationSubform.Form.RecordsetClone
.FindFirst "fldAddress='" & Me!txtheader_Address & "'"
Forms!frmNavigation.NavigationSubform.Form.Bookmark = .Bookmark
End With
End If
End Sub