UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Unable To Trap: No Current Record Error, Access 2013    
 
   
jjones888
post Dec 4 2018, 03:50 PM
Post#1



Posts: 6
Joined: 12-May 18



I have a shipping form. Once all the products have been shipped/removed from the list, I am alerted by Access that there is "No current record".
Great, I am aware of this.. How do I tell it to hush-up?

I put this in the form error event:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If Err.Description = "No current record" Then Resume
If Err.Number = 3021 Then Resume


and I put little handlers like this on nearly every event known to man:


Private Sub ShipType_Click()
On Error GoTo Handler


Handler:
If Err.Description = "No current record" Then Resume
If Err.Number = 3021 Then Resume


but Access doesn't care, it really wants me to know this and it will not stop. I plead and cry, but it insists.
Go to the top of the page
 
rsindle
post Dec 4 2018, 04:48 PM
Post#2


UtterAccess VIP
Posts: 1,695
Joined: 25-June 04
From: Northern Virginia


I usually do something like this:

CODE
Private Sub btnDo_Something_Click()
On Error GoTo Err_
    
    'some code to do something here
    
Exit_:
    Exit Sub
    
Err_:
    Select Case Err.Number
        Case 3021
            'Ignore this one, because I am aware of it
        Case Else
            MsgBox Err.Description
            Call LogError("btnDo_Something_Click", Err.Number, Err.Description, "App. Version " & gstrAppVersion, gstrUserName, gstrMachineName)
    End Select
    Resume Exit_
    
End Sub



I'm guessing if you put breakpoints in and step through the code, you'll find that the error is being raised somewhere where you DON'T have error trapping and is trickling back up.
Hope this helps.
R-
Go to the top of the page
 
tina t
post Dec 4 2018, 05:14 PM
Post#3



Posts: 5,613
Joined: 11-November 10
From: SoCal, USA


IIRC, Resume resumes the code at the line that erred, executing that line again. suggest you try Resume Next in this particular situation, instead.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
kfield7
post Dec 5 2018, 08:58 AM
Post#4



Posts: 907
Joined: 12-November 03
From: Iowa Lot


"...Once all the products have been shipped/removed from the list, I am alerted by Access..."

I assume the user is committing an action that causes the products to be "removed from the list."
To me, this kind of event should be planned for in the code, rather than trapped as an error.

It might be helpful to provide more detail on what's happening here, and show relevant code around this event.
Go to the top of the page
 
RJD
post Dec 5 2018, 02:27 PM
Post#5


UtterAccess VIP
Posts: 9,240
Joined: 25-October 10
From: Gulf South USA


Hi: I agree with kfield7 that seeing the code would be very helpful, probably decisive, in helping you with this issue. Meanwhile, look in your code to see if there is a xxx.MoveNext command (associated with a recordset - substitute your recordset id for xxx ) in your code, followed by an action on a record (that probably creates the message you are receiving). If so, after the MoveNext command, try a command line like this ...

If xxx.EOF Then GoTo FinalCleanup

... where FinalCleanup is a line label that takes you to the cleanup section of your code, at the end of the procedure, where you close the recordset and set it to Nothing. Or use whatever line label name you have given the last code section.

But again, we cannot be sure about this until we see your entire procedure code.

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    13th December 2018 - 10:23 AM