The Control Wizard in Access "classic" has provided VBA snippets or rather, full Sub...End Sub OnClick Procedures with error handling. People have copied the few productive lines in the procedures as well as the On Error procedure handling.
In Access 2007, the Control Wizard produces embedded macros in .accdb files. If, however, you work in a classic .mdb, the Control Wizard creates VBA code and improved VBA code over classic.
Run through making a "Close Form" button with the Control Wizard in an .mdb. You'll find that the VBA code has:
If Me.Dirty Then Me.Dirty = False
The Me.Dirty was missing the the Classic Control Wizard.
In the .accdb, the Wizard produces a macro with a Close Action, with a Prompt To Save parameter.
I see no sign of Dirty.