Hi, folks!
This ought to be easy -- but it's challenging my grip on reality (assuming, of course, I had a grip to begin with):
I have a form with fields on it bound to a query containing a single table. I can change values in the fields just fine (new value replaces old value in the field being edited). But, when I exit the form (close the pop-up), then re-open or activate the form, all the fields that I changed have reverted to the old values. That is, the new values aren't saved. I get no error messages or burps of any kind -- it simply does not save the newly entered values.
I've already tried running DoCmd.RunCommand acCmdSaveRecord as the form is closing, and I've tried adding the "Save" extension or parameter to the "docmd.close" command that closes the form.
Form and query RecordsetType values both have been set to Dynaset (Inconsistent Updates).
The form WILL save the new values if I use the PageUp/PageDown keys to move to another record and back before closing the form (Access default behavior) -- but this does NOT work if I run...
DoCmd.RunCommand acCmdRecordsGoToNext
DoCmd.RunCommand acCmdRecordsGoToPrevious
...when I close the form.
So the question is: What is the simple, reliable way to save changes to a record without having to go to the next record, and without using Save Record from the Records Menu? Isn't there, or shouldn't there be, a simple, single line statement that forces all changed values in bound fields to be saved on demand? Isn't the .Dirty property supposed to go True whenever there's a difference between the value in a bound field from a recordsource, and a NEW value entered in the field as the record is edited?
I'm closing the form using the form's KeyPress event triggered by the Escape key. It's obviously being executed correctly, because the form closes on command as expected, executing all other code in the process (except anything having to do with saving the record). Is there some other underlying invisible "safety" code executed when using the Escape key to close the form that overrides any code that tries to save records? Or maybe it's a bug that prevents explicit efforts to save records in certain situations.
I'm embarrassed at the huge number of hours that this particular problem has caused me to spend trying to do something so incredibly simple.
Thanks so much, folks.
Respectfully,
GWhiz
This ought to be easy -- but it's challenging my grip on reality (assuming, of course, I had a grip to begin with):
I have a form with fields on it bound to a query containing a single table. I can change values in the fields just fine (new value replaces old value in the field being edited). But, when I exit the form (close the pop-up), then re-open or activate the form, all the fields that I changed have reverted to the old values. That is, the new values aren't saved. I get no error messages or burps of any kind -- it simply does not save the newly entered values.
I've already tried running DoCmd.RunCommand acCmdSaveRecord as the form is closing, and I've tried adding the "Save" extension or parameter to the "docmd.close" command that closes the form.
Form and query RecordsetType values both have been set to Dynaset (Inconsistent Updates).
The form WILL save the new values if I use the PageUp/PageDown keys to move to another record and back before closing the form (Access default behavior) -- but this does NOT work if I run...
DoCmd.RunCommand acCmdRecordsGoToNext
DoCmd.RunCommand acCmdRecordsGoToPrevious
...when I close the form.
So the question is: What is the simple, reliable way to save changes to a record without having to go to the next record, and without using Save Record from the Records Menu? Isn't there, or shouldn't there be, a simple, single line statement that forces all changed values in bound fields to be saved on demand? Isn't the .Dirty property supposed to go True whenever there's a difference between the value in a bound field from a recordsource, and a NEW value entered in the field as the record is edited?
I'm closing the form using the form's KeyPress event triggered by the Escape key. It's obviously being executed correctly, because the form closes on command as expected, executing all other code in the process (except anything having to do with saving the record). Is there some other underlying invisible "safety" code executed when using the Escape key to close the form that overrides any code that tries to save records? Or maybe it's a bug that prevents explicit efforts to save records in certain situations.
I'm embarrassed at the huge number of hours that this particular problem has caused me to spend trying to do something so incredibly simple.
Thanks so much, folks.
Respectfully,
GWhiz