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 
OnClick RecordSource
Jessica Coplen 
    
4 years ago
I built a database to track specific items we receive. The search form in it works off a SQL query using NULL so everything is already a wildcard search. The search itself works perfectly, my issue is when you open the form, all the records show up. For the moment this is okay, but once we get into the thousands...

I did some googling to try to figure out how to make the search results empty when it opens. It was suggested to set the RecordSource using the OnClick when you hit the search button, leaving the form's default RecordSource blank. I did this, and it worked... until I closed the database and opened it again.

The code I'm using OnClick is RecordSource = "qrySearch"
The error I get is "Return without GoSub"

Now, if all I do is just open the VBA window and close it without changing anything, it starts working again. I can't ask my coworkers do that, so looking for a solution. I feel like I've missed something obvious here. Any help would be appreciated, thank you.
Kevin Robertson  @Reply  
          
4 years ago
Set the RecordSource to blank in the OnOpen event. The form will show no records when opened.
Kevin Robertson  @Reply  
          
4 years ago
Jessica,
Disregard that previous post. It will give you #Name errors in your fields.

Here is a better solution. Since an AutoNumber can never be 0, set it in the WHERE condition of an SQL statement.
This example shows what I mean.

Me.RecordSource = "SELECT * FROM CustomerT WHERE CustomerID=0"
Jessica Coplen OP  @Reply  
    
4 years ago
I knew I missed something obvious. Thanks, that worked. - Jess

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/7/2026 12:51:54 AM. PLT: 0s