从其它地方抄来这样的:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("保存吗?", vbOKCancel) = vbCancel Then
Cancel = True
End If
End If
End Sub
但是在关闭窗体时会出现出错提示. 保存倒是不保存了
Private Sub FORM_BeforeUpdate(Cancel As Integer)
If MsgBox("保存吗?", vbYesNo, Me.Caption) <> vbYes Then
Cancel = True
End If
End Sub
' 去除系统的报错信息:
Private Sub FORM_Error(DataErr As Integer, Response As Integer)
Response = acDataErrContinue
End Sub