You might like to take a look at ChangedRecordDemo.zip in my Dropbox public databases folder at:
https://www.dropbox.com/scl/fo/0scigd3r48hx5xrev2jrf/AB0-GMdTgMAO5O1cGdr3QW0?rlkey=ib6bs6g9jqcrywwzivur3265t&dl=0
In this little demo file the Form to Confirm Changes to Data option illustrates how to prompt the user to save or abort changes to the current record. Note that only actual changes to the values are detected , rather than merely updates. A record can be updated without the values of data having changed since the form was moved to the current record.
The code in the form's module firstly writes the current values to an array when the form is moved to a record. It then writes the values to another array and compares the two arrays. If any data have changed the user is prompted to confirm whether or not to save the changes. If not, the record is undone.
Another approach is illustrated in SaveDemo.zip in the same Dropbox folder. In this the user is forced to save, undo, or close the form by means of command buttons, which are enabled/disabled by code in the form's module on the basis of the current state of the record. In this case it detects all updates rather than those which have made actual changes to values.