Access VBA Macro Programming

(Joao Candeias) #1
You can generate an error in your code with theErrorstatement:

Sub Test_Error()


Error 71

End Sub


This simulates the “Drive not ready” error. You can also useErr.Raise(71)to do this. In
addition, you can regenerate the current error by using the following:


Error Err


The purpose of this is to raise the “Drive not ready” error message as if the drive really is
not ready and this is the current error found. If another error message is then created, this
becomes the current error.


Chapter 8: Errors and the Error Function 95

Free download pdf