• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • 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
 
pdvsaProject financeAuthor 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
 
pdvsaProject financeAuthor 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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