错误处理重复两次 [英] Error handling repeats twice

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

问题描述

在程序结束时,我有以下内容:


Exit_Proc:

退出Sub

Err_Proc:

调用ErrorLog(用户,错误类型,文件名)

resume exit_Proc

结束功能


奇数事情是如果有一个错误,下面的代码

Err_Proc在退出之前运行两次。

为什么Err_Proc下的代码会针对每个错误运行两次?

At the end of a procedure I have the below:

Exit_Proc:
Exit Sub
Err_Proc:
Call ErrorLog(user,error type, filename)
resume exit_Proc
End Function

The odd thing is if there is a single error the code underneath
Err_Proc runs twice before exiting.
Why does the code under Err_Proc run twice for each individual error ?

推荐答案

" pob" < po ******* @ gmail.comwrote in message

news:11 ********************** @ v33g2000cwv.googlegr oups.com ...
"pob" <po*******@gmail.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...

在程序结束时我有以下内容:


Exit_Proc:

退出Sub

Err_Proc:

调用ErrorLog(用户,错误类型,文件名)

resume exit_Proc

结束功能


奇怪的是,如果出现一个错误,则表示下面的代码

Err_Proc在退出前运行两次。

为什么Err_Proc下的代码会针对每个错误运行两次?
At the end of a procedure I have the below:

Exit_Proc:
Exit Sub
Err_Proc:
Call ErrorLog(user,error type, filename)
resume exit_Proc
End Function

The odd thing is if there is a single error the code underneath
Err_Proc runs twice before exiting.
Why does the code under Err_Proc run twice for each individual error ?



最后一行真的退出函数还是帖子中的拼写错误?


-

Rick Brandt,Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot com的RBrandt

Is the last line really Exit Function or is that a typo in your post?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


最后一行是结束功能


1月28日下午4:13,Rick Brandt < rickbran ... @ hotmail.comwrote:
The very last line is "End Function"

On Jan 28, 4:13 pm, "Rick Brandt" <rickbran...@hotmail.comwrote:

" pob" < pobnos ... @ gmail.comwrote in messagenews:11 ********************** @ v33g2000cwv.g ooglegroups.com ...
"pob" <pobnos...@gmail.comwrote in messagenews:11**********************@v33g2000cwv.g ooglegroups.com...

在程序结束时我有以下内容:
At the end of a procedure I have the below:


Exit_Proc:

退出Sub

Err_Proc:

调用ErrorLog(用户,错误类型,文件名)

resume exit_Proc

结束函数
Exit_Proc:
Exit Sub
Err_Proc:
Call ErrorLog(user,error type, filename)
resume exit_Proc
End Function


奇怪的是,如果单个错误下面的代码

Err_Proc在退出之前运行两次。

为什么Err_Proc下的代码会针对每个单独的错误运行两次?最后一行是否真的退出函数或者是帖子中的拼写错误?
The odd thing is if there is a single error the code underneath
Err_Proc runs twice before exiting.
Why does the code under Err_Proc run twice for each individual error ?Is the last line really Exit Function or is that a typo in your post?



-

Rick Brandt,Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot的RBrandt com


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


请注意这是一个函数。这个函数是从一个表单中调用的。


函数ImportFile()

OnError goto Err_ImportFile

做点什么

.......................

................ ............


Exit_ImportFile:

退出功能

Err_ImportFile:

调用ErrorLog(用户,错误类型,文件名)

恢复Exit_ImportFile

结束功能


1月28日,下午5:19,pob < pobnos ... @ gmail.comwrote:
Please note this a function. This function was called from a form.

Function ImportFile ()
OnError goto Err_ImportFile
Do something
.......................
............................

Exit_ImportFile:
Exit Function
Err_ImportFile:
Call ErrorLog(user,error type, filename)
Resume Exit_ImportFile
End Function

On Jan 28, 5:19 pm, "pob" <pobnos...@gmail.comwrote:

最后一行是结束功能


开1月28日下午4:13,Rick Brandt < rickbran ... @ hotmail.comwrote:
The very last line is "End Function"

On Jan 28, 4:13 pm, "Rick Brandt" <rickbran...@hotmail.comwrote:

" pob" < pobnos ... @ gmail.comwrote in messagenews:11 ********************** @ v33g2000cwv.g ooglegroups.com ...
"pob" <pobnos...@gmail.comwrote in messagenews:11**********************@v33g2000cwv.g ooglegroups.com...


在程序结束时我有以下内容:
At the end of a procedure I have the below:


Exit_Proc:

退出Sub

Err_Proc:

调用ErrorLog(用户,错误类型,文件名)

resume exit_Proc

结束函数
Exit_Proc:
Exit Sub
Err_Proc:
Call ErrorLog(user,error type, filename)
resume exit_Proc
End Function


奇怪的是,如果有一个错误,下面的代码

Err_Proc在退出前运行两次。

为什么Err_Proc下的代码对于每个单独的错误运行两次?最后一行是否真的退出函数或者是你帖子中的拼写错误?
The odd thing is if there is a single error the code underneath
Err_Proc runs twice before exiting.
Why does the code under Err_Proc run twice for each individual error ?Is the last line really Exit Function or is that a typo in your post?


-

Rick Brandt,Microsoft Access MVP

电子邮件( (视情况而定)...

在Hunter dot的RBrandt com
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


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

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