EnableMethodErrors example for Visual Basic

Note: Also works with Access 95 and 97.

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

' Declare local variables.
Dim ShearAngle, nRet, cMsg, answer

ShearAngle = 9000 ' This would be the user's input * 100
Lead1.EnableMethodErrors = False

nRet = Lead1.Shear(ShearAngle, TRUE, RGB(0,0,255))
If nRet = 20013 Then
   cMsg = "The angle cannot be more than 45 degrees"
   answer = MsgBox(cMsg, 0, "Error")
Else
   Lead1.ForceRepaint
EndIf

Lead1.EnableMethodErrors = True