Solved

Find a record with an Input box using LIke

Posted on 2010-08-28
7
440 Views
Last Modified: 2013-11-28
Experts, I need to first modify the below to handle "Like".  I also would like to know how to properly handle >1 record using the "Like".  It would be best to be able to hit "Next" or something like that to see the next record when using Like.  I am assuming this type of issue has been dealt with and someone can give me some code fot it.

thank you

Me.Recordset.FindFirst "[End User] =" & Chr(34) &  InputBox("Enter Name") & Chr(34)
0
Comment
Question by:pdvsa
7 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33550904
To get the Like working:Me.Recordset.FindFirst "[End User] Like '*" & InputBox("Enter Name") & "*'"That is a "contains" match.  For "begins with":Me.Recordset.FindFirst "[End User] Like '" & InputBox("Enter Name") & "*'"For "ends with":Me.Recordset.FindFirst "[End User] Like '*" & InputBox("Enter Name") & "'"
0
 

Author Comment

by:pdvsa
ID: 33550953
Ok.   How does it handle >1 match?
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33551121
What are you trying to do?  FindNext is all about finding *a* record, not multiple records...
0
Industry Leaders: 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!

 

Author Comment

by:pdvsa
ID: 33551405
Matthews, i am trying to find all records with a msgbox.   I think that "like" would be a start but not sure if i am on the right track.  

Is this Find Next:
  Me.Recordset.FindFirst "[End User] Like '*" & InputBox("Enter Name") & "*'"

it only finds the first record right?
0
 
LVL 6

Expert Comment

by:JVWC
ID: 33551855
A button added to a form using the wizard will create this functionality for you.
Add a button in design mode and choose "Record Navigation" and "Find Record" in the wizard.

Cheers
JC
0
 
LVL 1

Assisted Solution

by:mgoodspeed
mgoodspeed earned 50 total points
ID: 33552462
mathewspatrick has the good code.
You could set the RecordScource Property of a subform to the SQL string generated in his code to display the records, then select the one you want to modify.

Alternately, you could use a popup form if there are > 1 rows, then double-click it to navigate to the record you want
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 450 total points
ID: 33552743
If you want all records matching certain criteria, then instead of using FindFirst, why not simply open a recordset that will have only the records you care about?  You can then loop through that recordset to build up your MsgBox prompt.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

685 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