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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for Dirty and undo in Bound Form 1

Status
Not open for further replies.

perrymans

IS-IT--Management
Nov 27, 2001
1,340
US
As nice as unbound forms sound, they have been a nightmare to attempt, with constant type mismatch errors.

Since I can not stop a live link back to the backend, how about still forcing a "Save" action?

Have a Save button on a form and when clicked, changes (I assume) the Me.Dirty to False. THen allows for closing. But won't I have to then have code everywhere checking for a dirty condition on the multiple ways to close/ leave a record?

What is the best way to require a save first?

What about have the recordset a dbSnapShot? Does that make any difference?

Thanks. Sean.
 
Hi

Do not understand why you think having a bound form and type mismatch errors are connected

You can have a save button

if me.dirty then
docmd.runcommand acCmdSaveRecord
End if

or an undo button

if me.dirty then
docmd.runcommand acCmdUndo
end if

If you want to trap something before a record is saved (no matter how), put code in the before update event of the form


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Sean,

I had the same problem.

Its messy but I declared a Private Boolean within the module of the form and set it to false when the forms opened.

Then on the AterUpdate event of each of the controls on the form I added code to change the Boolean to true.

I then used the OnCurrent event of the form to check whether the Boolean was true, and if so force the user to save before moving off the record.

There's probably a better way, but I couldn't find it !

Cheers
 
Sorry I'd assumed you were using unbound forms. Kens answer should do the job for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top