after update

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form that can be edited and also allows for new additions. The form
is also connected to a second form and table and thus uses the afterupdate
demand to connect any additions or changes in the data. However, I want to
make it so when entering a new record or exiting the form the user is
prompted with a message notifying them that this will result in changes to
the database and do you want to continue. The problem is that regardless of
whether I click yes or no, the record is updated. is there a way that I can
click no and it will return me to my form? Or should I be using a function
other than afterupdate?

Also, is there a way that I can lock only certain aspects of a form with a
button to unlock them for editing? And also a button 'new record' that will
unlock the entire form but not display existing records?
 
You need to use BEFORE UPDATE because when the AFTER UPDATE event fires it is
too late.

Use Cancel = True
and Me.Undo to undo the changes
--
Bob Larson
Access World Forums Super Moderator
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista
 
Or should I be using a function
other than afterupdate?

Yep. Use BeforeUpdate and set Cancel = True if the user clicks "No".
By using AfterUpdate you are checking the barn doors after the horse has run
off (i.e., the record has already been saved).

HTH,
 
Back
Top