错误处理和“Exit_Sub” [英] Error Handling and "Exit_Sub"

查看:44
本文介绍了错误处理和“Exit_Sub”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部问候!


使用Exit_Sub会遇到麻烦吗?作为我的主要例程的结束,然后是我的错误处理?这是一个示例...

Greeting All!

Will I run into trouble using "Exit_Sub" as the end of my primary routine followed by my error handling? Here is a sample...

展开 | 选择 | Wrap | 行号

推荐答案

好问题,我不这么认为但我不确定你为什么不测试它?


创建一些事件并让每个事件都转到一个标签。看看你是否被抛出任何错误。
Good question, I don''t think so but I''m not sure. Why don''t you test it out?

Create a few events and have each event goto a label. See if you get thrown any errors.


我从来没有遇到任何问题,据我所知这是应该做的推荐方式,只要确保你考虑任何和可能需要关闭的所有记录集,应该被释放的对象等。
Ive never had any problems, as far as I know that is the recommended way that is should be done just make sure that you take into account any and all recordsets that may need to be closed, objects that should be released etc.


等等我只是重读....我认为你应该小心使用远离保留项目的任何东西一个简单的拼写错误可能会让你失望。我指的是使用Exit_Sub和Exit_Sub。作为一个标签,我认为用这样的东西很容易犯错,但实际上你的电话只是谨慎使用,并为任何不幸的结果做好准备。
Oh wait I just reread that.... I think you should be careful using anything remotely close to reserved items a simple typo could throw you off. By this I am referring to using "Exit_Sub" as a label I think it would be to easy to make mistakes with things like that but really it would be your call just use caution and be prepared for any unfortunate results.


这篇关于错误处理和“Exit_Sub”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆