Solved

Find a record with an Input box

Posted on 2010-08-28
5
389 Views
Last Modified: 2013-11-27
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
Comment
Question by:pdvsa
  • 3
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 33550659
Try this:



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

mx
0
 

Author Comment

by:pdvsa
ID: 33550677
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
 
LVL 75
ID: 33550728
" 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
 

Author Comment

by:pdvsa
ID: 33550761
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
 
LVL 75
ID: 33550771
You are welcome.

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

mx
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question