Both >4 and >5 are correct and good advice. I would also add that I habitually insert
- CleanUpAndLeave:
-
DoCmd.SetWarnings = True
-
DoCmd.HourGlass = False
-
Set (any databases, connections, recordsets etc) = Nothing
-
Exit Sub
into any sub I write with more than about 5 lines... and before any Error Handler I use.
I don't think this answers your main question though. Any time you make a change to an object, Access
should be asking you if you want to save changes when you close that object.
Except when you change data in a table, either directly or via a query or form (which would be based on a table or query anyway). That does get saved automatically*. As my mate Bill Gates used to say "That's not a bug, it's a feature"
Jim
* but that can also be intercepted programatically.