Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Form_Load() Me.TimerInterval = 1000 End Sub
Private Sub Form_Timer() If GetActiveWindow() <> hwnd Then DoCmd.Close acForm, "窗体" End If End Sub