1、新建一模块把下面代码复进去:Option Compare Database
Option Explicit
Public allowSave As Boolean
Public Function NoAllowSave()
allowSave = True
End Function
2、把“=NoAllowSave()”复制到所有文本框属性里的事件选项卡中的“更改”右边的文本框里
Private Sub Form_Open(Cancel As Integer)
'在窗体打开事件里输入
allowSave = False
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
'在窗体更新前事件里输入:
If allowSave = True Then
If MsgBox("当前数据已经被修改,是否保存?", vbYesNo + vbQuestion, "请选择...") = vbYes Then
Else
Me.Undo
End If
End If
End Sub
http://gy0503.id666.com
gy0503@126.com