Re: Confirm data change on close

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You are correct. closing the form or the application will save any changes.

There is no real good reason to use a save button. It is just that some
people are afraid they will save data they don't want to save.

--
Dave Hargis, Microsoft Access MVP


"raylopez99" wrote:

On Jan 4, 10:35 am, Klatuu <Kla...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
For your save button:

If Me.Dirty Then
Me.Dirty = False
End If

For your Exit Button, just use Docmd.Close in the click event. Put the code
to check for changes in the Form's Unload event. That way, if the user
closes the form either using the exit button or by some other means, it will
stilll do the check.

Put this in the Form Unload event:


Very interesting thread but I have a newbie question--I understand the
principle behind Save in Windows, but in Access it seems that clicking
on the red "X" in the upper right corner always saves the record
automatically. That is, for any form I've worked with to date (about
2 weeks of VB programming to be sure), it seems (maybe I'm wrong) that
no data has ever been lost this way (by simply closing the form as
described above).

In short, why bother with "save"--it's it the default to save
everything if a form/control is dirty?

There is no real good reason to do this. It is just that some people are
afraid they will save data they don't want to save.


RL

.



Relevant Pages

  • Re: Disable Database Close
    ... Users sometimes accidentally close the database when they meant to only close ... I'd like to make them start using File -> Exit to really ... I don't think you can do it that way, because the only technique I know of for preventing unintended closing via the X button would also prevent closing via File -> Exit. ... The hidden form's Unload event procedure would check the value of the check box, and cancel the Unload event if it is not set to True. ...
    (microsoft.public.access.formscoding)
  • Re: Disable Database Close
    ... Jeff and Dirk, ... MS Access from closing via the red X. ... I'd like to make them start using File -> Exit to ... The hidden form's Unload event procedure would check ...
    (microsoft.public.access.formscoding)
  • Re: Application.Exit or End
    ... .Net Framework 1.1 ... reason to use it. ... In most cases closing the forms will exit the program. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Outlook 2003 crashing/not closing
    ... The reason that I ask is ... >not closing. ... PDA synchronization software with your PDA in the cradle. ... Mail reminder add-ins that keep a stub of Outlook open in the ...
    (microsoft.public.outlook)
  • RE: Apply test before allowing form to close
    ... Bob ... > On the unload event of the form you can check if all the fields are filled, ... > if not then give a message box, and the write cancel = true ... >> How can I stop the form from closing if my test parameters are not met? ...
    (microsoft.public.access.formscoding)