O'Reilly logo

F. Scott Barker's Microsoft® Access 2000 Power Programming by F. Scott Barker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CREATING USER-DEFINED ERRORS

By using the CVErr() and IsError() functions and the Application.AccessError method, you can create your own functions that can return an error value if an error situation occurs in the function. Here's a short description of each function and method that can be used:

  • The CVErr() function converts a value to an Error data type, assigning it to a Variant variable.

  • The IsError() function checks to see whether a Variant is an Error data type.

  • The Application.AccessError method provides an error description without the error itself.

An example of using these commands is when you divide two numbers—either the function receives a text value instead of the number needed, or a zero is sent. Listing 7.10 shows the cmdTestCVErr_Click ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required