Question : Why am I now receiving a 2105 runtime message



I have created two navigation buttons (via the wizard) to go next and previous.

This all works perfectly with all my forms until now.

When I reach the end of my recordset, I receive a nice message "You can't go to the specific record".

However if I'm at the beginning of my recordset, and I select my button to go Previous, I receive  a VB error message.

I haven't changed the wizard coding, see below:

The only thing that has changed is that I have a Sub Form, within a Sub Form.  

As I say the Next is not a problem, just my previous and only where its a SubForm within a SubForm.

NB the coding is placed within the correct subform
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Private Sub btnGotoPrevious_Click()
 
' Goes to the Previous Record
    DoCmd.GoToRecord , , acPrevious
 
Exit_btnGotoPrevious_Click:
    Exit Sub
 
Err_btnGotoPrevious_Click:
    MsgBox Err.Description
    Resume Exit_btnGotoPrevious_Click
    
End Sub

Answer : Why am I now receiving a 2105 runtime message

since the error 2105 is returned, I suggest you handle it error handler:




Exit_Continue:
    Exit Sub

Error_Routine:
    If err.number = 2105 then
        Resume Exit_Continue
    Else
        MsgBox "Error# " & Err.Number & " " & Err.Description
        Resume Exit_Continue
    End If
   
Random Solutions  
 
programming4us programming4us