A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old July 14th, 2009, 08:35 PM posted to microsoft.public.access
BrianPaul
external usenet poster
 
Posts: 200
Default Got this code to work, How can I modify it.

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
  #2  
Old July 14th, 2009, 08:58 PM posted to microsoft.public.access
BrianPaul
external usenet poster
 
Posts: 200
Default Got this code to work, How can I modify it.

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


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


"BrianPaul" wrote:

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.