Bypass Error 3021 vba code??? (1 Viewer)

basshead22

Registered User.
Local time
Today, 08:51
Joined
Dec 17, 2013
Messages
52
Hello!!

I'm trying to figure out how to by pass error 3021 No current record

I know I can put the code below just don't know where to put it.

If Err.Description = "No current record" Then Resume

I attached a pic of my code that is causing the error .. and its okay I just want to by pass the message box.
 

Attachments

  • Capture.JPG
    Capture.JPG
    35.5 KB · Views: 189

mdlueck

Sr. Application Developer
Local time
Today, 11:51
Joined
Jun 23, 2011
Messages
2,631
I started receiving random 3021's when I switched my Multiple Item / Continuous Forms to not show a blank row when no data was populating the form. Since such forms in my applications are read-only, there is no point in displaying a new record row which they will never be allowed to enter data into.

My remedy was to add a Form level Error handler as follows to all my Multiple Item / Continuous Forms:

Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)

  Select Case DataErr
    Case 3021
      '3021 is a "No current record" error
      Response = acDataErrContinue
    Case Else
      Response = acDataErrDisplay
  End Select

End Sub
BTW: I also needed to update my shared code to safely read Form Controls. The link to that code is here:

Safely read form field text controls
http://www.access-programmers.co.uk/forums/showthread.php?t=221107&page=3#post1131115

(Then press enter in the URL bar to make sure the web browser locates upon the correct post in page.)
 

missinglinq

AWF VIP
Local time
Today, 11:51
Joined
Jun 20, 2003
Messages
6,423
What, exactly, was being attempted, when the error popped? It's generally better policy to figure out why you're seeing an error message, before you simply ignore it; sometimes you might need to see it!

Linq ;0)>
 

jdraw

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Jan 23, 2006
Messages
15,364
I agree with Linq - why are you getting the error?

No records in the recordset? Attempting to read past EOF?
Report issue
 

Users who are viewing this thread

Top Bottom