0

My search command is looking for a Part by it's description. The following code works great for an exact match search but I would like a code that will go to the closest match in the recordset. Any help will be appreciated....

Private Sub search_cmd_Click()
Dim txtsid As String
Dim Founder As Boolean

txtpart = UCase(InputBox("Enter Part Description:", "Description Search"))
If Len(txtpart) > 0 Then
Data1.Refresh
Data1.Recordset.MoveFirst
Founder = False
End If

Do While (Not Founder) And (Not Data1.Recordset.EOF)

If UCase(Data1.Recordset.Fields("Description").Value) = txtpart Then
Founder = True
Exit Sub
End If
Data1.Recordset.MoveNext
Loop

If Not Founder Then
MsgBox "Unable to find the required item", , "Not Found"
Data1.Recordset.MoveLast
End If
End Sub

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by snurd
0

This was a small modification of "abu taher"s code which works very well. I just need it to go to the closest match. Thanks "abu taher".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.