Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 429
  • Last Modified:

Find a record with an Input box

experts,

I am using the below but get a syntax.  Any suggestions?
Private Sub cmdFind_Click()

    Me.Recordset.FindFirst "End User" & InputBox("Enter Name")
   
End Sub
0
pdvsa
Asked:
pdvsa
  • 3
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Try this:



    Me.Recordset.FindFirst "[End User] =" & Chr(34) &  InputBox("Enter Name") & Chr(34)

mx
0
 
pdvsaAuthor Commented:
OK that works.  Can you add a "like" into that?  I wonder how this code addresses the fact that there could be two or more records if i use a "like"?  I assume it would go to the first one but then not sure about the second one.  Do you have an idea about that or maybe I should go about it another way.  

thank you
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
" I assume it would go to the first one but then not sure about the second one."
As is, it's just going to find the first occurrence in the Recordset.

Well, using Like is a different paradigm.  You will have to decide what to do - if anything - with additional occurrences ... or something that is only a partial hit ... ala Like "ABC" ....

mx
0
 
pdvsaAuthor Commented:
OK. Well I think I need to rephrase this question.  I will close it out as you have provided an answer.   I will ask another that requests to handle multiple occurences and see what happens.  I do need to handle multiple occurrences for "like".  

thank you mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
You are welcome.

Yes ... decide "*how* ... you want to handle multiple occurrences first ....

mx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now