Here’s how to do it:
- Open the form in 'Design View'.
- Click on the 'Property Sheet' option.
- Click the 'Event' section.
- Set the 'On Error' event for forms to run custom error-handling logic by clicking the ellipsis icon.
- Enter the expression and click 'OK'.
- Save your work by clicking the save icon.