vba ms 访问关闭表单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3408697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ms access close form
提问by Icode4food
I know that docmd.closewill close the current form but for some reason I have gotten it in my head that I want to be more explicit. What I do is docmd.close acForm, me.name.
我知道这docmd.close会关闭当前的表单,但出于某种原因,我已经意识到我想要更明确。我所做的是docmd.close acForm, me.name。
Is that totally crazy or is there a good reason to do this?
这完全是疯了还是有充分的理由这样做?
回答by Oorang
Calling DoCmd.Close with no argument closes the active window. Using the Me.Name syntax accounts for scenarios where the form in question is not the active window (example running hidden). Personally I prefer the explicit version as it does exactly what you want, whereas the implicit version will probablydo what you want.
不带参数调用 DoCmd.Close 将关闭活动窗口。使用 Me.Name 语法可以解决有问题的表单不是活动窗口(例如运行隐藏)的情况。我个人更喜欢显式版本,因为它完全符合您的要求,而隐式版本可能会做您想要的。

