从sub中修改另一个sub。 [英] CAlling another sub from a sub.

查看:121
本文介绍了从sub中修改另一个sub。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用表格'vba编码的

OnError事件为表单设置了自定义错误消息。


但是,当错误由命令按钮触发,未调用OnError事件,您必须在命令按钮的On Error GoTo语句上手动编写该错误。


我的问题是,你如何回忆你在表格的OnError事件中所做的编码,进入命令按钮的On Error Goto。

示例:

I have set up customized error messages for a form using the
OnError event of the form''s vba coding.

However, when the error is trigerred by a command button, the OnError event is not called and you have to manually code that error on the On Error GoTo statement of the command button.

My question is this, how can you recall the coding you made on the OnError event of the form, into the On Error Goto of the command button.

Example:

展开 | 选择 | Wrap | 行号

推荐答案


我已经使用表格'vba编码的

OnError事件为表单设置了自定义错误消息。


但是,当命令按钮触发错误时,不会调用OnError事件必须在命令按钮的On Error GoTo语句上手动编写该错误。


我的问题是,你如何回忆你在表格的OnError事件中所做的编码,进入命令按钮的On Error Goto。

示例:

I have set up customized error messages for a form using the
OnError event of the form''s vba coding.

However, when the error is trigerred by a command button, the OnError event is not called and you have to manually code that error on the On Error GoTo statement of the command button.

My question is this, how can you recall the coding you made on the OnError event of the form, into the On Error Goto of the command button.

Example:

展开 | 选择 | Wrap | 行号


假设这是VBA而不是VB6,我看到一个问题这是你子的名字!


Private Sub Form_OnError (DataErr As Integer,Response As Integer)


虽然它在'Property Box'形式中被称为OnError事件,但它实际生成的是sub s是


Private Sub Form_Error (DataErr作为整数,响应为整数)


除非这是随着Access的最新版本而改变了,我不认为它(但是用Micro
Assuming this is VBA and not VB6, one problem I see here is the very name of your sub!

Private Sub Form_OnError(DataErr As Integer, Response As Integer)

While it''s called the OnError event in the form''s Property Box, the sub it actually generates is

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Unless this is something that''s changed with the latest verison of Access, and I wouldn''t think it is (but with Micro


你永远不知道)也许这就是为什么表单层错误处理不是不工作。


Linq ; 0)>
oft you never know) maybe this is why the form level error handling isn''t working.

Linq ;0)>


这篇关于从sub中修改另一个sub。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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