Before Update (1 Viewer)

jatfill

Registered User.
Local time
Today, 18:11
Joined
Jun 4, 2001
Messages
150
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

Registered User.
Local time
Today, 23:11
Joined
Apr 17, 2001
Messages
634
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
 

Users who are viewing this thread

Top Bottom