Hello everbody,
I have a search field where I can look for an employees by writing their firstname/lastname. It works currently well, but when I look
for firstname/lastname which exists more than ones, i cannot see all of them.
E.g. there are two Persons in the table, who have the lastname Mustermann
(Susi Mustermann, Max Mustermann), when I write Mustermann in the searchfield
it shows me Max Mustermann and when I click on next button it shows me another
entry in the table which is not Susi Mustermann (but in the access table itself after Max follows Susi)
Does somebody have any idea, how could I edit my next/preveous button, such that if I click it, it would show other Mustermanns (if they exist)
The next/preveous button are default buttons from access. This is my currently code for the search Button:
Code:
Private Sub suchBefehl_Click()
Dim strSearch As String
strSearch = Me.txt_Search & ""
If Len(strSearch) Then
Me.MA_Nachname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Nachname, strSearch) = 0 Then
Me.MA_Vorname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Vorname, strSearch) = 0 Then
Me.MA_Nachname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Vorname, strSearch) = 0 Then
MsgBox "No matching record found!", vbInformation
End If
End If
End If
End If
Me.txt_Search.SetFocus
End Sub
I have a search field where I can look for an employees by writing their firstname/lastname. It works currently well, but when I look
for firstname/lastname which exists more than ones, i cannot see all of them.
E.g. there are two Persons in the table, who have the lastname Mustermann
(Susi Mustermann, Max Mustermann), when I write Mustermann in the searchfield
it shows me Max Mustermann and when I click on next button it shows me another
entry in the table which is not Susi Mustermann (but in the access table itself after Max follows Susi)
Does somebody have any idea, how could I edit my next/preveous button, such that if I click it, it would show other Mustermanns (if they exist)
The next/preveous button are default buttons from access. This is my currently code for the search Button:
Code:
Private Sub suchBefehl_Click()
Dim strSearch As String
strSearch = Me.txt_Search & ""
If Len(strSearch) Then
Me.MA_Nachname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Nachname, strSearch) = 0 Then
Me.MA_Vorname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Vorname, strSearch) = 0 Then
Me.MA_Nachname.SetFocus
DoCmd.FindRecord strSearch, acAnywhere
If InStr(Me.MA_Vorname, strSearch) = 0 Then
MsgBox "No matching record found!", vbInformation
End If
End If
End If
End If
Me.txt_Search.SetFocus
End Sub