如何在错误捕获中捕获过程名称。 [英] How to capture the procedure name in error trapping.

查看:63
本文介绍了如何在错误捕获中捕获过程名称。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我已经在下载文件中扩展了Rob Henderson提供的代码: http://www.vb123.com/toolshed/04_acc...orhandling.htm


此代码允许您提供详细的错误捕获给用户。它目前将打印出错误编号,描述和创建错误的表单。

除此之外,代码还允许您在表格中自动记录这些错误。


我正试图找到一种方法来扩展,只是告诉哪个表单创建了错误 - 我想要一种方法来记录调用错误的过程。


我的问题实际上是从程序中调用错误函数。目前错误代码如下所示:

Currently I''ve expanded on the code provided by Rob Henderson in the download file here: http://www.vb123.com/toolshed/04_acc...orhandling.htm

This code allows you to provide detailed error trapping to the user. It will currently print out the error number, description, and form that created the error.
As well as this, the code will allow you to automatically record these errors in a table.

I''m trying to also find a way to expand on just being told which form has created the error - I would like a way to record the procedure that has called the error.

My problem is actually calling the error function from the procedures. Currently the error code looks like this:

展开 | 选择 | Wrap | 行号

推荐答案

嗨Adam,


我在网上搜索过,这个问题的答案似乎不是,不是简单的方法,你必须操纵堆栈!我确实找到了适合你的产品,名为vbWatchdog,价格为45英镑。


还有另一个解决方案。我在这里写了一篇文章,自动在所有过程中实现全局错误处理。我现在根本没有写任何错误处理。当我完成编码时,我运行我的例程并将所有错误处理放入。


现在,我的观点是我的代码,在生成错误处理时,知道它正在修改的程序的名称,因此你可以修改我的代码,将prodcedure名称添加到你自己的错误处理中。


现在,我如何提供一个链接到我的文章?

它被称为

访问中的自动错误处理
http://bytes.com/topic/access/insigh...andling-access


不幸的是,Err对象似乎没有引用错误发生的行号。否则你可以引用 Me.Module.ProcOfLine(< ErrLine>,lngProcType)其中lngProcType是一个Long,它获取返回的过程类型的返回值。


这种技术可能仍然有用,但我认为没办法将它直接绑在错误线上我很害怕。即使< Current Line>的概念也是如此。在任何可以使用的地方都可以使用,因为错误处理程序通常在同一过程中运行。在那里找不到任何东西我都害怕。
Unfortunately the Err object seems to have no reference to the line number that the error occurred on. Otherwise you could reference Me.Module.ProcOfLine(<ErrLine>, lngProcType) where lngProcType is a Long which takes a returned value of the type of procedure returned.

This technique may still prove useful but I see no way to tie it directly to the error line I''m afraid. Even if the concept of the <Current Line> were available anywhere this could be used, as the error handler typically runs within the same procedure. Nothing found there either I''m afraid.


我对互联网的搜索得到了答案,但是我想我也会问这里的专家。

这个功能只是其中一个小额外。这很好,但我当然不想支付45英镑!


之前我听说过自动错误编码,从来没有真正研究过它。我快速浏览了你的文章,看起来内容相当丰富,所以我会仔细阅读一下,看看是否有帮助。


谢谢Lysander。


Adam。
My search of the internet came up with the answer of no as well, but I figured I''d ask the experts here as well.
This functionality is just one of those "little extras" that are nice to have, but I certainly don''t want to pay £45 for it!

I''ve heard of automatic error coding before, just never really looked into it. I had a quick skim of your article and it looks rather informative, so i''ll have a closer read of that and see if that can help.

Thanks Lysander.

Adam.


这篇关于如何在错误捕获中捕获过程名称。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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