引用ACCESS窗体控件的方法
(2014-02-08 14:30:27)分类: VBA |
有一个窗体From1,和它的一个控件control1,以下2条代码的差别是什么:
Form1.control1 ‘用dot来引用控件
From1!control1 ‘用bang来引用控件
主要差别是:
l
l
l
l
l
主要就是2点:dot早期绑定,dot引用在运行时不能更新窗体的类型库。
在某个窗体或报告的所有控件属于一个控件集合(controls collection)。
属于某个控件类别的所有控件属于这个类别的控件集合。
在tab控件或option group控件里面的所有控件属于这个控件的控件集合。
附属于另一个控件的label控件属于这个控件的控件集合。
可以implicityly或explicitly的引用这个控件集合。
l
l
l
l
l
l
l
You can use the Me keyword to represent a Form or Report within code only if you’re referring to the form or report from code within the class module.
If you’re referring to a form or report from a standard module or a different form’s or report’s module, you must use the full reference to the form or report.