Errors and Error Handling

So far, the examples in this chapter have contained no error handling. This means that they leave what happens when an error occurs up to chance. Although T-SQL provides a means of handling errors, the error-handling model in T-SQL is not as powerful as that in VBA. Because there's no ON ERROR GOTO statement, you must handle errors as they occur.

Handling Runtime Errors

One alternative to handling errors as they occur is to prevent errors from occurring in the first place. The Orders table in the Northwind database requires that data be entered for the OrderID and RequiredDate fields. The OrderID field is an IDENTITY column, so this is not of concern. Here's the error that occurs if a value is not supplied for the required ...

Get Alison Balter's Mastering Access 2002 Enterprise Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.