Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE A FIELD VALUE ON AFTER UPDATE & INSERT

Status
Not open for further replies.

shyamsundar

Programmer
Aug 23, 2002
75
IN
Hi tech guys,

I have a data entry form. I am calculating the weightage of that record and inserting/updating a value on one field of the record based on the values of other fields. Now my problem is where to put the event, if afterinsert or afterupdate or both.

Pl. note, if the user is changing the value on the other field, the event should take place.

pl. help

thanks Shyam
cwizshyam@yahoo.com
 
Hi shy,

How about in the 'On Click' event of a command button with a label: Save or Update?

Why not?

Regards,

Darrylle

"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." AND "A pointer to a solution is better than the solution - you'll remember the solution via a pointer". darrylles@totalise.co.uk
 
Actually, you don't want to put this in either AfterUpdate or AfterInsert. Both of those events happen after the record has been saved. If you change a field in one of those events, the record has to be saved again before Access will allow you to move to another record. This makes the navigation buttons (or other navigation techniques you provide) seem like they're not working right.

When you want to calculate a field value based on updates to other fields (or record insertions), use the BeforeUpdate event. BeforeUpdate fires for both changes and insertions, so you don't need to do it in BeforeInsert.
Rick Sprague
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top