Office中国论坛/Access中国论坛

标题: 【函数】窗体关闭时关闭所有打开的窗休 [打印本页]

作者: tmtony    时间: 2012-11-4 09:01
标题: 【函数】窗体关闭时关闭所有打开的窗休
这是早期写的系统关闭时的一个方法。与大家分享一下
在系统关闭前先关闭已经打开的窗体会比较安全

For Each aoj In CurrentProject.AllForms
If aoj.name <> "frmMain" Then '关闭除主窗体外的所有窗体
  Docmd.Close acform, aoj.name
End If
Next

也可使用类似的方法来做其它事情,如把窗体全部更换为英语,或法语等语言

For Each aoj In CurrentProject.AllForms
If aoj.name <> "frmZstmSetLang" Then
  Me.lblPregress.Caption = "Processing Form:" & aoj.name
  gt_GenLangPackToTable 2052, "Form", aoj.name
  DoEvents
End If
Next

另 鱼儿游游 网友发现,使用FORMS枚举不行,要枚举CurrentProject.AllForms
作者: zhuyiwen    时间: 2012-11-4 09:38
谢谢分享
作者: 秋风萧萧    时间: 2012-11-5 09:28
学习学习
作者: Agent    时间: 2012-11-5 09:39
不错不错.




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3