B
BARKAROO
I need a prompt for User to Save Changes in a Form. I got the following code
from the Microsoft Support Site. It seemed to work fine. But then it just
stopped working. When I checked the code again, it seemed to "remember"
again. I'm using a copy of Access 2000, and the support site says that this
code is for 95/97.
Should that make a difference? Here's the code:
-------------------------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
' This procedure checks to see if the data on the form has
' changed. If the data has changed, the procedure prompts the
' user to continue the save operation or cancel it. Then the
' action that triggered the BeforeUpdate event is completed.
On Error GoTo Err_BeforeUpdate
' The Dirty property is True if the record has been changed.
If Me.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Do you want to save?", vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
Me.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
MsgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub
from the Microsoft Support Site. It seemed to work fine. But then it just
stopped working. When I checked the code again, it seemed to "remember"
again. I'm using a copy of Access 2000, and the support site says that this
code is for 95/97.
Should that make a difference? Here's the code:
-------------------------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
' This procedure checks to see if the data on the form has
' changed. If the data has changed, the procedure prompts the
' user to continue the save operation or cancel it. Then the
' action that triggered the BeforeUpdate event is completed.
On Error GoTo Err_BeforeUpdate
' The Dirty property is True if the record has been changed.
If Me.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Do you want to save?", vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
Me.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
MsgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub