If you want to ignore the message just put
"On error resume next" under whatever subroutine the error occurs


Like this:

Private Sub cmdCancel_Click()
On error resume next
Dim xVar As Integer

xVar = MsgBox("Are you sure you wish to cancel?", _
vbQuestion + vbYesNo)

If xVar = 6 Then
'-- cancel operation
Unload Me
End If

End Sub









Or you can go a step further and do this

Private Sub cmdCancel_Click()
On error goto getdahellouttahere
Dim xVar As Integer

xVar = MsgBox("Are you sure you wish to cancel?", _
vbQuestion + vbYesNo)

If xVar = 6 Then
'-- cancel operation
Unload Me
End If
getdahellouttahere:
exit sub
End Sub




but the most simple way would to just:

Private Sub cmdCancel_Click()
Dim xVar As Integer

xVar = MsgBox("Are you sure you wish to cancel?", _
vbQuestion + vbYesNo)

If xVar = 6 Then
'-- cancel operation
Unload Me <-----Replace this simply with "Exit Sub"
End If

End Sub






Have Phun



"There is more than one way to skin a cat"