A family of Microsoft relational database management systems designed for ease of use.
Yes, its called Error Trapping. I suggest searching on Access VB Error Trapping to find more details. You didn't give us enough info to give more than a suggestion.
It might look like this
ON ERROR GOTO ErrorHandler 'This line goes near the top of your code
:ErrorHandler
Select Case Err.Number
Case 3021
MsgBox "your message"
Case Else
MsgBox Err.Number & "-" & Err.Description
End Case