Find next code (1 Viewer)

sandy2011

Registered User.
Local time
Today, 08:32
Joined
Feb 3, 2011
Messages
32
Hi,

I am looking to add to this code.. (as below)

I have a combo box in which i select a name it finds the associated record with the name entered. However, if i want to find another record with the same name - i have to press ctrl & f and click on find next..


Can I add a "find next" piece of code to it?

I want to select name and if it is not that record when i hit enter again it finds the next record with the same name and so on ...
e.g. I could have 3 records with name Smith on it? When i select the first smith, only the first record appears.


DoCmd.FindNext doesnt work at end of code?

Anyone any ideas?

Here is current code:



Private Sub Combo367_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CallRef] = " & Str(Nz(Me![Combo367], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.Combo367 = Null




End Sub
 

Taruz

Registered User.
Local time
Today, 16:32
Joined
Apr 10, 2009
Messages
168
Hi.. ;)

this for your the combobox..:

Private Sub Combo367_AfterUpdate()

Me!CallRef.SetFocus
DoCmd.FindRecord Me![Combo367], acAnywhere

End Sub


this is to go other records..:

Screen.PreviousControl.SetFocus
DoCmd.FindNext


you can write a button ..
 

sandy2011

Registered User.
Local time
Today, 08:32
Joined
Feb 3, 2011
Messages
32
THanks for your help Taruz :)... have tried the code and have come up with

run time error '438' ?
 

Users who are viewing this thread

Top Bottom