打开与关闭窗体的函数
将一些常用命令写成函数,以简化您的程序
如关闭窗体指令可将之写成以下形式放在模块中
Function strCloseForm(strFormName As String) As String
On Error GoTo strCloseForm_Err
DoCmd.Close acForm, strFormName
strCloseForm_Exit:
Exit Function
strCloseForm_Err:
MsgBox Error$
Resume strCloseForm_Exit
End Function
调用方法:关闭本窗体 strCloseForm(Me.Name)
关闭其它窗体 strCloseForm("FormName")
将一些常用命令写成函数,以简化您的程序
如关闭窗体指令可将之写成以下形式放在模块中
Function strCloseForm(strFormName As String) As String
On Error GoTo strCloseForm_Err
DoCmd.Close acForm, strFormName
strCloseForm_Exit:
Exit Function
strCloseForm_Err:
MsgBox Error$
Resume strCloseForm_Exit
End Function
调用方法:关闭本窗体 strCloseForm(Me.Name)
关闭其它窗体 strCloseForm("FormName")
本文介绍了一个简化窗体打开与关闭操作的函数。该函数通过封装DoCmd.Close命令,实现窗体的快速关闭,并提供错误处理机制。
1366

被折叠的 条评论
为什么被折叠?



