Solved

Find a record with an Input box using LIke

Posted on 2010-08-28
7
422 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now