D
Dic_nutana
Dear all can anyone help please?
I'm having trouble trapping error 2501.
I'm using access 2003 (in 2000 mode) and I'm trying to trap the error when
opening a form with no data, here's my code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrHandler
If Me.Recordset.RecordCount = 0 Then
MsgBox "Sorry there are no records" & vbCrLf & vbCrLf & _
"to display for this selection.", vbInformation + vbOKOnly, _
" No Records"
Cancel = True
End If
Open_exit:
Exit Sub
ErrHandler:
If Err.Number = 2501 Then
Resume Open_exit
Else
MsgBox Err.Number & " - " & Err.Description
Resume Open_exit
End If
End Sub
I get my custom message OK but then I still get the system message . What
have I done wrong? I'm sure this should work but I'm not sure where I have
gone wrong!
Many thanks in advance
Regards Richard
I'm having trouble trapping error 2501.
I'm using access 2003 (in 2000 mode) and I'm trying to trap the error when
opening a form with no data, here's my code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrHandler
If Me.Recordset.RecordCount = 0 Then
MsgBox "Sorry there are no records" & vbCrLf & vbCrLf & _
"to display for this selection.", vbInformation + vbOKOnly, _
" No Records"
Cancel = True
End If
Open_exit:
Exit Sub
ErrHandler:
If Err.Number = 2501 Then
Resume Open_exit
Else
MsgBox Err.Number & " - " & Err.Description
Resume Open_exit
End If
End Sub
I get my custom message OK but then I still get the system message . What
have I done wrong? I'm sure this should work but I'm not sure where I have
gone wrong!
Many thanks in advance
Regards Richard