Private Sub 产品ID_BeforeUpdate(Cancel As Integer)
Call confirmupdate(Me!产品ID)
End Sub
Private Sub confirmupdate(x As Control)
Dim i As Integer
i = MsgBox("记录已被修改,确认要修改该条记录吗?", vbOKCancel)
If i = 1 Then
Exit Sub
ElseIf i = 2 Then
Me!x.Undo
Cancel = True
End If
End Sub
Function confirmupdate() As Integer
If MsgBox("记录已被修改,确认要修改该条记录吗?", vbOKCancel) = vbOK Then
confirmupdate = False
Else
confirmupdate = True
End If
End Function
Private Sub 产品ID_BeforeUpdate(Cancel As Integer)
If confirmupdate() Then
Cancel = True
Me.产品ID.Undo
End If
End Sub