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

x
?
Solved

Find a record with an Input box using LIke

Posted on 2010-08-28
7
Medium Priority
?
469 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 93

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 93

Expert Comment

by:Patrick Matthews
ID: 33551121
What are you trying to do?  FindNext is all about finding *a* record, not multiple records...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 200 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 93

Accepted Solution

by:
Patrick Matthews earned 1800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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.

886 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