变量作为控件名称 [英] Variables as Control names

查看:103
本文介绍了变量作为控件名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对表单上的各种控件运行相同的检查,包括更新前事件和更新后事件。

I would like to run the same set of checks on various controls on a form, including a before update event and an after update event.

展开 | 选择 | Wrap | 行号

推荐答案

您可以制作可以从任何事件程序调用的通用代码(在程序中)。


但是,设置通用事件过程是不可能的,因为没有通用事件。您想要处理的每个事件都必须有一个事件过程,即使它只是调用另一个过程然后退出。


请记住这不是VBA代码逻辑,这是Access中的设计你正在谈论。
You can make generic code (in a procedure) that can be called from any of the event procedures.

It is not possible though, to set up generic events procedures, as there are no generic events. Each event you want handled must have an event procedure, even if it simply calls another procedure then exits.

Bear in mind this is not VBA code logic, this is the design within Access you''re talking about.


好的我想我明白了你的意思。喜欢捕获事件的控制名称btnX_click我需要btnX_click事件才能找到被点击的btn?


今天下午不确定我的大脑是否正常。


谢谢。
Ok I think I see your point. Like to capture control name for the event btnX_click I would need the btnX_click event to find which btn has been clicked?

Not sure my brain is in straight this afternoon.

Thank you.


不用担心。在这种情况下,将主代码放在一个地方,然后从各种控制事件过程中调用该过程实际上是一个非常好的主意。
No worries. It is actually a very good idea in such circumstances to have the main code in a single place, then just call that procedure from the various control event procedures.


这篇关于变量作为控件名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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