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 
Need Msgbox for When Listbox is Empty
Nilsen Septon 
   
14 months ago
I have a form with a text box and a list box. When I type a name in the text box and press 'Enter', the results show in the list box - this is working just fine. However, if there are no results to display, the list box is just empty. I'd like to display a msgbox if there are no results to display...but can't figure out how to do that.

Both the text and list boxes are unbound, the list box Row Source = SELECT ID, Name, PersonType FROM BusPersUQ WHERE (((BusPersUQ.Name) Like "*" & [Forms]![GlobalSearchF]![GlobalSearchEntry] & "*"));

I understand how I can use a msgbox in other scenarios...this one has me stumped. I wish there were a 'On No Data' option like with a Report........
Adam Schwanz  @Reply  
           
14 months ago
If ListBox.ListCount = 0 Then
Msgbox "No Records"
End If
Nilsen Septon OP  @Reply  
   
14 months ago
@Adam Schwanz - I've tried a few things 'like' that (I will try yours), but my biggest question is....'where' does that get put. I've tried on the form, on the textbox (events...), and on the listbox (events...) - I mean, I understand the syntax, I just don't know where to put it. Thanks.
Adam Schwanz  @Reply  
           
14 months ago
I would put it in the button you are pressing to show the results and the listbox.
Nilsen Septon OP  @Reply  
   
14 months ago
@Adam Schwanz - Since I'm only entering values in the textbox and pressing enter (not using a button), the key was to use the 'Before Update' event (of the textbox). I had tried something very similar while also using the 'Before Update' event but without success. It very well could have been the code that I used. Your code along with the 'Before Update' event worked so I'll take that as a win!! THANKS!!!

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/6/2026 2:38:17 PM. PLT: 0s