获取Form_Error捕获的错误的实际文本? [英] Get actual text of error trapped by Form_Error?

查看:66
本文介绍了获取Form_Error捕获的错误的实际文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

民众


有>> ANY<<获取由

Form_Error事件捕获的错误的实际文本的方法?


我的意思是实际文本,如:XYZ表中的重复记录 ;,而不是模板文本

喜欢:表格中的重复记录| 1。


我需要这个用于通用错误处理程序。我已经尝试了所有的东西

显而易见,包括err.description,dbengine.errors集合&等等。

我认为答案是肯定的。我想被证明是错的。


TIA,

TC


Folks

Is there >>ANY<< way to get the actual text of an error that is trapped by
the Form_Error event?

I mean actual text like: "duplicate record in table XYZ", not template text
like: "duplicate record in table |1".

I need this for a general purpose error handler. I''ve tried everything
obvious, including err.description, the dbengine.errors collection & so on.
I think the answer is NO. I would like to be proved wrong.

TIA,
TC


推荐答案

TC,


在Form_Error事件中,添加以下行:

MsgBox AccessError(DataErr)


你将能够看到实际文本 - 至少我可以查看运行时间

错误3022(欺骗)和2169(可以保存记录。


TC < a@b.c.d>在消息新闻中写道:1071375900.155857@teuthos ...
TC,

In the Form_Error event, add this line:

MsgBox AccessError(DataErr)

and you''ll be able to see the actual text - at least I could for run-time
errors 3022 (dupes) and 2169 (can''t save record).


"TC" <a@b.c.d> wrote in message news:1071375900.155857@teuthos...
人们

是否有>> ANY<<获取由Form_Error事件捕获的错误的实际文本的方法?

我的意思是实际文本,如:表XYZ中的重复记录,而不是模板
文本如:表格中的重复记录| 1。

我需要这个用于通用错误处理程序。我已经尝试了很明显的一切,包括err.description,dbengine.errors集合&所以
on。我认为答案是肯定的。我想被证明是错的。

TIA,
TC
Folks

Is there >>ANY<< way to get the actual text of an error that is trapped by
the Form_Error event?

I mean actual text like: "duplicate record in table XYZ", not template text like: "duplicate record in table |1".

I need this for a general purpose error handler. I''ve tried everything
obvious, including err.description, the dbengine.errors collection & so on. I think the answer is NO. I would like to be proved wrong.

TIA,
TC



有办法要做到这一点,但这真的很棒,并且这种技术无法在Access 2000中完美地工作,仅在97或2002年。


基本上,您必须使用BeforeUpdate或BeforeDeleteConfirm拦截每次尝试保存或删除记录

,在

表单的RecordsetClone上自行执行操作,然后取消事件。由于实际更新在VB代码中发生了
,你可以在那里捕获错误。


为了在代码中执行更新,你必须循环所有表格

控制,并确定哪些具有ControlSource属性,并将

设置为不以=字符开头的非空白文本,并复制

将控制值中的数据写入记录集字段值。

此外,您必须确保不要复制任何IsEmpty值,

因为这些字段应该接收它们的默认值,你还必须确保记录集中的字段是可更新的,而不是只读的。


请注意,使用ODBC链接表时,没有任何确定可更新性的技术是100%可靠的

,因此您可能必须使用标签属性或其他内容来支持
表示非在该字段中未正确反映的可更新字段

对象属性。


请注意,部分解决方案可以在文章185384的MS支持中找到。

不要说它是偏的,但我发现你必须添加了许多特殊的

案例检查以查找任何真实用途,并且它不包括

删除记录的情况。


On Sun,2003年12月14日14:55:24 +1200,TC < a@b.c.d>写道:
There is a way to do this, but it''s really bizzare, and the technique cannot
be made to work flawlessly in Access 2000, only in 97 or 2002.

Basically, you have to intercept every attempt to save or delete a record
using BeforeUpdate or BeforeDeleteConfirm, perrform the action yourself on the
form''s RecordsetClone, then cancel the event. Since the actual update happens
in VB code, you can capture the error there.

In order to perform the update in code, you have to loop through all the form
controls, and determine which ones have ControlSource properties, and have
them set to non-blank text that does not begin with the = Character, and copy
the data from the control values into the recordset field values.
Additionally, you have to make sure you don''t copy any value that IsEmpty,
since those fields should receive their default values, and you must also make
sure the field in the recordset is updateable, not read-only.

Note that no techniques for determining the updateability of are 100% reliable
with ODBC linked tables, so you may have to use a tag property or something to
indicate non-updateable fields that are not properly reflected in the field
object properties.

Note that a partial solution can be found on MS Support in article 185384.
The don''t say it''s partial, but I found that you have to add a lot of special
case checks for any real-worls usage, and it doesn''t cover the case of
deleting a record.

On Sun, 14 Dec 2003 14:55:24 +1200, "TC" <a@b.c.d> wrote:
人们

是否有>> ANY<<获取由Form_Error事件捕获的错误的实际文本的方法?

我的意思是实际文本,如:表XYZ中的重复记录,而不是模板文本
喜欢:表格中的重复记录| 1。

我需要这个用于通用错误处理程序。我已经尝试了很明显的一切,包括err.description,dbengine.errors集合&等等。
我认为答案是肯定的。我想被证明是错的。

TIA,
TC
Folks

Is there >>ANY<< way to get the actual text of an error that is trapped by
the Form_Error event?

I mean actual text like: "duplicate record in table XYZ", not template text
like: "duplicate record in table |1".

I need this for a general purpose error handler. I''ve tried everything
obvious, including err.description, the dbengine.errors collection & so on.
I think the answer is NO. I would like to be proved wrong.

TIA,
TC






这适用于没有可替换的,特定于案例的
参数的错误消息,但对于具有可替换参数的错误消息不起作用。

它也不会为ODBC错误工作,所以任何ODBC错误都会简单地说ODBC

Error - 不是很有用。


2003年12月13日星期六23:49:20 -0500,DFS <无**** @ nospam.com>写道:
That does work for error messages that do not have replaceable, case-specific
arguments, but does not work for error messages with replaceable arguments.
It also doesn''t work for ODBC errors, so any ODBC error will simply say "ODBC
Error" - not very useful.

On Sat, 13 Dec 2003 23:49:20 -0500, "DFS" <no****@nospam.com> wrote:
TC,

在Form_Error事件中,添加以下行:

MsgBox AccessError(DataErr)

你将能够看到实际的文本 - 至少我可以在运行时错误3022(欺骗)和2169(不能保存记录)。


TC < a@b.c.d>在消息新闻中写道:1071375900.155857@teuthos ...
TC,

In the Form_Error event, add this line:

MsgBox AccessError(DataErr)

and you''ll be able to see the actual text - at least I could for run-time
errors 3022 (dupes) and 2169 (can''t save record).


"TC" <a@b.c.d> wrote in message news:1071375900.155857@teuthos...
人们

是否有>> ANY<<获取由Form_Error事件捕获的错误的实际文本的方法?

我的意思是实际文本,如:表XYZ中的重复记录,而不是模板
Folks

Is there >>ANY<< way to get the actual text of an error that is trapped by
the Form_Error event?

I mean actual text like: "duplicate record in table XYZ", not template


text


text

喜欢:表格中的重复记录| 1。

我需要这个用于通用错误处理程序。我已经尝试了很明显的一切,包括err.description,dbengine.errors集合&所以
like: "duplicate record in table |1".

I need this for a general purpose error handler. I''ve tried everything
obvious, including err.description, the dbengine.errors collection & so


on。


on.

我认为答案是否定的。我想证明是错的。

TIA,
TC
I think the answer is NO. I would like to be proved wrong.

TIA,
TC





这篇关于获取Form_Error捕获的错误的实际文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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