Hi, everyone.
I want my form to save the record only when the user clicks the Save button. If the form is closed in any other way, then discard the changes to the record.
I found a thread on bytes.com that addresses this:
http://bytes.com/groups/ms-access/835113-force-user-save-form-data
Basically, the respondent indicates that there are two ways to go about this:
Use an unbound form with ADO code behind
OR
Use a bound form with a boolean variable that gets set to true when the user clicks the save button. In the form's Unload event, check if the variable is true. If it's true, then just close the form. If it's false, use Me.Undo to undo whatever was done on the form, then close the form.
The respondent says that they prefer the first option because it is "cleaner and safer."
I am leaning the other way--I am trying to get rid of most of my unbound forms in an effort to take advantage of Access's ability to handle record manipulations through bound forms.
Are there other preferred ways to go about this? Why would it be "safer" to use ADO rather than the Me.Undo statement? I would like to use bound forms, so I would like a robust solution for a bound form.
Thanks,
Duluter
I want my form to save the record only when the user clicks the Save button. If the form is closed in any other way, then discard the changes to the record.
I found a thread on bytes.com that addresses this:
http://bytes.com/groups/ms-access/835113-force-user-save-form-data
Basically, the respondent indicates that there are two ways to go about this:
Use an unbound form with ADO code behind
OR
Use a bound form with a boolean variable that gets set to true when the user clicks the save button. In the form's Unload event, check if the variable is true. If it's true, then just close the form. If it's false, use Me.Undo to undo whatever was done on the form, then close the form.
The respondent says that they prefer the first option because it is "cleaner and safer."
I am leaning the other way--I am trying to get rid of most of my unbound forms in an effort to take advantage of Access's ability to handle record manipulations through bound forms.
Are there other preferred ways to go about this? Why would it be "safer" to use ADO rather than the Me.Undo statement? I would like to use bound forms, so I would like a robust solution for a bound form.
Thanks,
Duluter
Last edited: