Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Record Not Found
Mark Kaply 
       
4 years ago
How can I check for a "Record Not Found" condition when I "filter" my database and do not get a return. (See attached). My Form just goes blank and I have to hit the "Toggle Filter" option to reset my form. I need to be able to perform an error check to be able to automatically reset my filter and "MsgBox" the user.  THANKS
Mark Kaply OP  @Reply  
       
4 years ago
Oopps, I did not get the option to attach my screen shots...
Mark Kaply OP  @Reply  
       
4 years ago

Mark Kaply OP  @Reply  
       
4 years ago

Scott Axton  @Reply  
        
4 years ago

I cant see your code so hard to tell you exactly.  Basically you need something like this:


      If IsNull(YourSearchField) Or Forms!YourSearchField = 0 Then
         MsgBox " No Records found with given search parameter. "
      Exit Sub

Scott Axton  @Reply  
        
4 years ago

I just realized you're still in the Beginner Lessons and you may not have the VBA knowledge you need yet.

Take a look at the Search Form 2.0  video.

If you really want to know more, check out the Search Seminar for the most comprehensive coverage of searching.
Kevin Robertson  @Reply  
           
4 years ago
This is how I would handle this problem.

Dim mySearch As String, myRoadName As String

mySearch = InputBox("Please enter all or part of the road name", "Search For Road Name")
If mySearch = "" Then Exit Sub

myRoadName = Nz(DLookup("RoadName", "MapT", "RoadName LIKE ""*" & mySearch & "*"""),"")
If myRoadName = "" Then
    MsgBox "The road name you entered could not be found.", vbInformation, "Record Not Found"
    Exit Sub
End If


Obviously it may need some slight modification to suit your exact needs.
Mark Kaply OP  @Reply  
       
4 years ago
Thank you for your help gentlemen. I watched the Search 2.0 video but I'm still a bit confused. I got the MsgBox working if the user enters a "null" search value HOWEVER I want to also send the same msg back when a valid search value is entered that is NOT in my database. (Please see the code attached.) I tried another "If" statement after the "Me.FilterOn = True" command but I get a "Type Mismatch" runtime error.  Any thoughts ??
Richard Rost  @Reply  
          
4 years ago
Thread continued here: POST

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: 5/1/2026 11:26:13 PM. PLT: 1s