在 MS Access VBA 中等待表单关闭的最佳方法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6446692/
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
What's the best way to wait for a Form to be closed in MS Access VBA?
提问by Lance Roberts
I call a Form from a module, and would like to wait for the Form to be closed before completing the rest of that module. What is a proper way to do the waiting?
我从一个模块调用一个表单,并希望在完成该模块的其余部分之前等待该表单关闭。等待的正确方法是什么?
I have an IsOpen("formname")function to check to see if the Form is still open.
我有一个IsOpen("formname")函数来检查表单是否仍然打开。
采纳答案by Ahmad
set WindowMode:=acDialog
when you initiate DoCmd.OpenForm
WindowMode:=acDialog
启动时设置DoCmd.OpenForm
Here is how it is done from other Office VBA (Excel, Word, VB6, VB.Net) Call the form modally using the following code
以下是如何从其他 Office VBA(Excel、Word、VB6、VB.Net)使用以下代码模态调用表单
Dim f as new FormNameHere
f.Show True 'True is the option for Dialog in VB
' form will be displayed until the user dismisses it then execution continues
set f = Nothing
Otherwise:
除此以外:
f.ShowDialog