Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Search Form 2.0 < Hangman | Rich Text >
Back to Search Form 2.0    Comments List
Search Two Fields Upload Images   Link   Email  
Matthew McHenry 
I am trying to look up customer by phone number. In CustomerT there are PhoneNumber1 and PhoneNumber2. Is there way in VBA to search both fields just using one "search box"?

I am still in the deigning phase of my Database so I'm not against putting all the PhoneNumber in their own Table.
Kevin Robertson 
You could do something like this.
WhereStr = WhereStr & "PhoneNumber1 LIKE ""*" & txtSearch & "*"" OR PhoneNumber2 LIKE ""*" & txtSearch & "*"""
Matthew McHenry 
I think I mess up " somewhere

    
    If PhoneNumberSearch <> "" Then
        If WhereStr <> "" Then WhereStr = WhereStr & " AND "
        WhereStr = WhereStr & "PhoneNumber1 LIKE ""*" & PhoneNumberSearch & "*""" Or "PhoneNumber2 Like""*" & PhoneNumberSearch & "*"""
    End If
Adam Schwanz 
Look at what's different in yours and Kevins.

You have an extra quotation in the middle. It doesn't need "*""" in the middle, it only has that extra " at the end to close the statement.
Adam Schwanz 
One of the most confusing things is the quotations. Just remember everytime you start with a ", you are opening a statement, and at the end of the statement you need another " to close it.
Matthew McHenry 
Fount them both the way I had it PhoneNumber2 was a txt str not a feild to be search.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Search Form 2.0.
 

 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/28/2024 6:10:03 AM. PLT: 0s