Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Using LIKE
Carmen Vazquez 
    
4 years ago
I have the following code:
sName = StrConv(Me.RequestByPerson.Value, vbProperCase)
Me.RRequestorID = DLookup("[tbl_Requestors].[RequestorID]", "tbl_Requestors]", "[tbl_Requestors].[txtResolvedName] Like '%" & sName & "%')

I also tried using * in place of % but it's returning a null value when I know the record exists.  

These are for estimates that are copied from previous year so it auto-fills some of the form based on the previous estimate selected. Within that time the name field has changed where the resolvedName is Bunny, Bad B and the RequestByPerson is Bad Bunny.

So I want to search in txtResolvedName "Like" RequestByPerson.Value

Thanks in Advance!
Kevin Robertson  @Reply  
          
4 years ago
You are missing an opening square bracket "tbl_Requestors]".
Carmen Vazquez OP  @Reply  
    
4 years ago
that's because I typed verbatim, I actually have the bracket in the original code.
Scott Axton  @Reply  
      
4 years ago
I'm sure someone will correct me if I'm wrong but I don't believe you can put a wildcard search in a DLookup like that.
Almost positive that you will never get a match that way.

If you need to search for records based on that type of criteria check out the Search Form 2.0 video.
Kevin Robertson  @Reply  
          
4 years ago
Scott You actually can. I just tried. I think it must be the implementation.

Carmen
Can you post some screenshots so we can get a better understanding?
Adam Schwanz  @Reply  
           
4 years ago
You're also missing a closing " in the where criteria it looks like. "%'"
Adam Schwanz  @Reply  
           
4 years ago
LIKE '*" & [sName] & "*'")

This should work
Scott Axton  @Reply  
      
4 years ago
Kevin  -
I figured some one would let me know.  I stand corrected.
Now the question is would you ever want to?  

Since the example above is
Me.RRequestorID = you could only return one ID  AND  that ID would be the first one it found.  Correct?

What if you're looking for Smith and there was 50 of them?  It would always return the first regardless of if that is the right one or not.

I guess I'd opt for a different search method personally.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/17/2026 7:15:48 PM. PLT: 0s