首页 > 解决方案 > 取消form.unload事件时如何返回到指定控件?

问题描述

我打开表格:

DoCmd.OpenForm "Form", acNormal, , , acFormEdit, acWindowNormal

表单卸载事件:

Private Sub Form_Unload(Cancel As Integer)

If Len(Me.acntName.Value) = 0 Then
    Msgbox "Account Name must be specified."      
    Cancel = True
    Me.acntName.SetFocus
end if

End Sub

这会将我返回到表单,但不会将焦点放在控件上。我该怎么做呢?

标签: ms-access

解决方案


推荐阅读