Error Code 2163

Stoss

Registered User.
Local time
Today, 17:30
Joined
Nov 5, 2010
Messages
107
I am getting error message 2163...which states...
"2163 - The page number you used as an argument for the GoToPage action or method doesn't exist in this form"

Page 1 of this main form is the default form that is always up. I am working in another form (search form) in which I call that main form then goto page 3. It works fine the first time with no error message, but if I go back to the search form and click another item, I then get that message. Also, without any error trapping, it works fine to (the error of course is still there it just doesn't show it and doesn't create a problem).

So, I coded in the error trapping part that if the err.number = 2163 to resume.

2 Questions
1. Is this a good way to handle this error message?
2. When I do this, it now seems to hang (hour glass and everything)

Code:
Private Sub lstSearchedPriorities_DblClick(Cancel As Integer)
   
On Error GoTo ErrHandler
    
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName = "Form2"
    
    stLinkCriteria = "[index]=" & lstSearchedPriorities.Column(0)
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToPage (3)

Exit_ErrHandler:
    Exit Sub
    
ErrHandler:
    If Err.Number = 2163 Then
        Resume
    Else
        MsgBox Err.Description
        Resume Exit_ErrHandler
    End If
End Sub

I know that I could just take the error trapping code out but I want to be the good programming and handle this right.

Still, I really am wondering why it hangs. Is the "Resume" part of the error trapping code wrong?

Thanks,
Stoss
 
As I just submitted that, I realized that I should have put in "Resume Next" and not just "Resume". It works fine now.

I guess that I still have the question if this is a good way to handle this situation. Basically, if it already on Page 3 it gives me this error.

-Stoss
 
If first you don't succeed, try try try again ;)
 

Users who are viewing this thread

Back
Top Bottom