Computer Learning Zone CLZ Access Excel Word Windows

Power comes not from knowledge kept but from knowledge shared.

-Bill Gates
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > TechHelp > Access >
Back to TechHelp    Comments List
Single Field Search Upload Images   Link   Email  
Giovanni Miranda      
9 months 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             
9 months 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      
9 months 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      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months ago

Giovanni Miranda      
9 months 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!

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


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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/17/2024 1:16:51 PM. PLT: 1s