Got this code to work, How can I modify it.

B

BrianPaul

How could I modify the code below to go to the record if it was partial. For
example: If I was looking for the name Brian or Bryan but wasnt sure, I could
enter into the cboMoteTo "br" and it would navigate to the first record br.
Thanks, any help would be greatly appreciated.



Private Sub cboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[remarks] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If

End Sub
 
B

BrianPaul

This code works, Which
Dirk Goldgar, MS Access MVP
www.datagnostics.com
Understood my question better than I asking It. Thanks Dirk, The code
worked Fine, I thought I better post it here If others were trying to search
the forum for a simular type situation but wasnt considering filtering
records when navigating through records vs. filtering records.

Something like this:

'----- start of example code ------
Private Sub txtSearchRemarks_AfterUpdate()

Dim strSought As String
Const Q As String = """"
Const QQ As String = Q & Q


strSought = Me.txtSearchRemarks & vbNullString

If Len(strSought) > 0 Then

With Me.Recordset

..FindFirst "Remarks Like " & Q & "*" & _
Replace(strSought, Q, QQ) & "*" & Q

If .NoMatch Then
MsgBox "Not found."
End If

End With

End If

End Sub
'----- end of example code ------
 

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