View Full Version : Before Update


jatfill
06-12-2001, 07:24 AM
I have several data entry forms that I am adding before update checks to so that I can minimize mistaken data entry, this works well but I have a question about it:

Assuming all of the entered data is accurate, I would like a final msgbox to ask the user if they are sure they want to save the record before continuing... if they click cancel, I'd like to NOT save the record and clear the form. I've tried this, but I always get Access error messages that it can't save the record.... what's the proper way to set something like this up?

charityg
06-12-2001, 07:31 AM
In the form before update event
Dim ctlC As Control
if me.dirty=true then
If msgbox("Are you sure you want to save?,vbyesno)=vbno then


' For each control.
For Each ctlC in Me.Controls
If ctlC.ControlType = acTextBox Then
' Restore Old Value.
ctlC.Value = ctlC.OldValue
End If
Next ctlC
endif
endif
End Sub