How do I update a table when I close my form?

marathonlady

Registered User.
Local time
Today, 18:26
Joined
Jul 10, 2002
Messages
120
I want my table to update on my last record entry when I close the form.
Now, I just have docmd.close under the Close button and the last entry didn't make it to the table. What do I need to do?

Thanks.
 
Save the current record if it is dirty before you close the form.

A better way would be to prevent the user from closing the form if the current record is dirty. What if the user modified the current record but did not want to modify it much less save the changes? You need to alert the user that the record has been modified and ask them to either save the current record or undo their recent changes to the current record.

The forms BeforeUpdate event is the key to doing what you want.

Check out these two links for working examples on how to do it...

A better mouse trap? Another twist on how to prevent a modifed record from being saved unless the user clicks a custom Save button.

Enable/Disable The Control Box X Button The form named "fTestCancelFromUnloadEvent" in the Enable/Disable The Control Box X Button sample db will demonstrate how you can prevent a user from closing a form and also the application unless they do exactly what you want them to do.
 

Users who are viewing this thread

Back
Top Bottom