Computer Learning Zone CLZ Access Excel Word Windows

There are no limits when you are surrounded by people who believe in you, or by people whose expectations are not set by the short-sighted attitudes of society, or by people who help to open doors of opportunity, not close them.

-Neil deGrasse Tyson
Home   Courses   Seminars   Templates   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > TechHelp > Access >

Back to TechHelp

Single Field Search Upload Images   Link  
Giovanni Miranda 
19 days ago
I've got this code on a few of my Fields to do Specific searches on those Fields, but for some reason I never noticed this happen before.  When I search for on a particular Field that does have what I'm looking for everything is fine, but when it doesn't find anything and I try to get out of the Filter I get this error:

Run-Time Error "3021"
No Current Record.

When I debug it brings me to this code:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
End Sub

With Me.Recordset.MoveLast highlighted.

This is my search code:

Private Sub SearchAirportCodeBtn_Click()
    Dim S As String
    S = InputBox("Please Enter The IATA or IACO Airport
    Code", "SEARCH For A Specific IATA or IACO Airport

    If S = "" Then Exit Sub
    Me.Filter = "AirportCode LIKE ""*" & S & "*"""
    Me.FilterOn = True
End Sub

But the First Code is associated with this code:

Private Sub Form_Current()
    RecCountBx = Me.Recordset.AbsolutePosition + 1 & " of "
    & Me.Recordset.RecordCount
End Sub

Kevin Robertson
19 days ago
How is the first code associated with the code in the Form_Current event (There is no call to it)?

Also, can you please post some screenshots of your Form, the error, your code (with the highlighted line that generated the error) and anything else you feel may be relevant.
Giovanni Miranda
19 days ago

Here are the Images and the explanation with each Image:

First Image - Current Form I am working with
Second Image - Starting my Search
Third Image - What I'm Searching for, but it's not in the Database
Fourth Image - No results, I Click to remove the Filter (at the bottom)
Fifth Image - Error Box appears
Sixth Image - I Click Debug button
Seventh Image - Yellow area where Debug took me to

and the ONLY way I can get out of the Loop of getting the error again when I try to click the Filter to clear is to Exit the Form itself.
Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

Giovanni Miranda
19 days ago

I appreciate you racking your brain out as well in helping me.  Just to let you know I took that statement out of my code as it really doesn't seem to affect my record count as to where it's pointing to in my RecCountBx Field that keeps track of the Record I'm on and how many records I have.

Seems my system is fast enough to keep up with the function itself and it isn't lagging behind to give me wrong record number readings at the bottom of the Form.  So, I've left it out and everything seems to be working fine now.  I appreciate all your help and trying to get this resolved for me.

Fast flights and safe landings!
Add a ReplyUpload an Image

Back to TechHelp Comments

Start a NEW Conversation
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
Subscribe to TechHelp
Get notifications when this page is updated

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

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

Copyright 2023 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 9/25/2023 11:40:59 PM.