Full Version: You can't go to the specified record. You may be at the end of a
UtterAccess Forums > Microsoft® Access > Access Forms
dashiellx2000
I have a split database with about 20 users. On the main form where these 20 users enter data, there is a button for New Account. Occasionally, when a users hits the button, they get the error message "You can't go to the specified record. You may be at the end of a recordset." 99.9% of the time, they hit the button again after closing the msg box and it works and they are taken to a new blank record. .1% of the time, they get caught in this loop were the error keeps coming up, they can't exit the form using the Exit button I provided and have to close the entire database.
That causes this error and how can I eliminate it?
Thanks.
khaos
What is the code behind the button?
dashiellx2000
Sorry, I guess that would've helped:
!--c1-->
CODE
Private Sub NewAcct_Click()
On Error GoTo Err_NewAcct_Click
Dim ActionMsg As String
Dim Title As String
ActionMsg = "No Action has been selected for this account." & vbCrLf & _
"Before going to a new account, please select an Action."
Title = "New Account"
If Me.ProductivityID = "" Or IsNull(Me.ProductivityID) Then
    MsgBox "You are already on a new request", vbInformation, Title
    Else
    If Me.CPIAcctNum = "" Or IsNull(Me.CPIAcctNum) Then
        MsgBox "You have not entered a CPI/Account Number", vbCritical, "CPI/AcctNum"
        Me.CPIAcctNum.SetFocus
        Else
        If Me.ActionID = 0 Then
            MsgBox ActionMsg, vbCritical, Title
            Else
            DoCmd.GoToRecord , , acNewRec
            Forms!sfrmTodaysAccounts.Requery
        End If
    End If
End If
Exit_NewAcct_Click:
    Exit Sub
Err_NewAcct_Click:
    MsgBox Err.Description
    Resume Exit_NewAcct_Click
    
End Sub
dashiellx2000
Sorry, hate to do this, but I simply don't understand how this error is being caused.
Thanks.
khaos
I'd try adding line numbers, I use MzTools for this. Change the error handler to the following.
sgBox Err.Description & " - " & err.number & " - " & erl
Let me know what line the code errors on and the error number.
Ken
dashiellx2000
I have a very hard time recreating this error as it doesn't happen often. I would assume it is happening no the DoCmd.GoToRecord , , acNewRec line as this is the only line in the code which is attempting to move the record. If I find someone who has this happen to them again, I'll see what I can do.
guess there's no simple reason for this error.
khaos
Sorry I missed your reply. I'd guess it was that line as well but I have been surprised before. I'd throw the extra error handling in as well as the line numbers. This will make error debugging much easier. My system has the error pop up and allows the user to send me the error with more info than what I posted. It is also saved to a text file no matter what so problems can be looked into at any time. If you get the error again I'd recommend seraching the MS knowledge base with exact error message and error number. Sometimes some oddity exists and it has been documented there. I have had decent luck with that method.
TH
Ken
dashiellx2000
Thanks Ken. MZTools doesn't work with A97 unforunetly so I could figure out how to add line numbers. I did add a little more error handling to hopefully get more info the next time the error occurs. I did figure out a C&R made it go away, but explain my users why and how to do that would be very fustrating.
Thanks again.
khaos
If you have a split db then a compact on close is a very good solution as it just compacts with no user intervention. That's very disappointing about 97. I had no idea that this, or any com add-ins wouldn't work with that version. This is one of those tools I don't know what I would do without. I know there are other line numbering apps but they may have the same issue as this.
en
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.