One "Resume Next" or two?

D

David Portwood

Suppose I have error handling code similar to the following:

Err_MyFunction:
on error resume next
rst1.close
rst2.close

I don't want to see an error message from trying to close recordset vars
which are already closed. I actually want/expect them to be closed. But of
course, depending on where the error occurred, one or both rst vars might
still be open when the error handler fires, so I put the "resume next"
statement to guard against this eventuality.

But suppose both rst vars are already closed when the error handler fires?
In this case, both close statements should generate an error. Does the one
"resume next" cover this? Do I need two "resume next" statements?
 
D

Douglas J. Steele

You only need one Resume Next statement.

What that statement says is for every error that occurs from that point on,
just continue on to the next line.
 
D

David Portwood

I understand. Thanks, Doug.

Douglas J. Steele said:
You only need one Resume Next statement.

What that statement says is for every error that occurs from that point
on, just continue on to the next line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top