clearing me.dirty

  • Thread starter BBC via AccessMonster.com
  • Start date
B

BBC via AccessMonster.com

Help! how can Me.Dirty be cleared without causing the record to be saved.
In my Form_BeforeUpdate (or wherever is best), when a record is Dirty, I
want to be able to allow to allow the user to, AFTER clicking my form's SAVE
button (also applies to NEXT,... buttons)
1) Save it
2) Not Save it and continue (to next record for example)
3) Cancel the operation all together and stay on the existing record/form and
continue working.

It isn't clear to me what method to use to accomplish this.
For step 1, in my SAVE sub I've tried
Me.Dirty --causes it to go through my From_BeforeUpdate where I ask the
Yes/No/Cancel, or
DoCmd.RunCommand acCmdSaveRecord --would then put the Y/N/C in the SAVE
sub
doing this does not seem to clear Dirty (or DoCmd.GoToRecord
, "", acNext)
Is that really true?

Both of these methods create problems with the Don't Save and Cancel methods.
Now matter what I've tried I seem to get tangled up in the Dirty flag, It
seems if I can clear Dirty maybe I can get past this.
Anyone have a good example I could follow
Thanks all
 
B

Banana

By definition, you cannot clear a dirty flag without saving or undoing
the edits.

That said I'm kind of unclear on the process here. It sounds like you
want your users to explicitly click 'save' button before proceeding? If
that is so, I would suggest that you are swimming upstream and may only
annoy your users more. A more simpler method would be to use the
BeforeUpdate event to validate the records and alert the users of any
errors or invalid data before allowing it to be saved. If you really
wanted, you still (and seem to have done so already) use the messagebox
to choose from Yes/No/Cancel and run the save code or cancel out of the
BeforeUpdate event.

Also, it kinds of sound like you want the "No" button to basically undo
the edits. If so, just use Me.Undo for the No case. This should then
clear the dirty flag as well cancel any pending edits. Is that what you
meant?
 
B

BBC via AccessMonster.com

Hmmm, maybe you are right, after many weeks of frustration maybe I am trying
to control things I should let happen more naturally, but not sure how/where
(Events)
On my form I have 4 Nav buttons (<<, <, >, >>) plus Save, Undo, Delete and
New. Currently when the record goes dirty I highlite the SAVE & UNDO buttons
and the user can save/undo the changes at any time. However when they select
NEW or record movement things go bad when trying to Save (if Dirty) or Not
Save the changes and then create the new record or when they decide to cancel
the "New" action and just continue on with the current record/form.

In fact the "Save" (DoCmd.RunCommand acCmdSaveRecord) seems to leave the
record Dirty afterwards (thus my desire to clear the Dirty). I use the
Form_BeforeUpdate to try to take the appropriate action combined with the
SAVE, navigation and New buttons without success.
I seem to be going around & around on this and can't seem to make all these
actions come together. I've gotton to the point I can't even explain all the
things I've tried and have not worked.
Frustrating
By definition, you cannot clear a dirty flag without saving or undoing
the edits.

That said I'm kind of unclear on the process here. It sounds like you
want your users to explicitly click 'save' button before proceeding? If
that is so, I would suggest that you are swimming upstream and may only
annoy your users more. A more simpler method would be to use the
BeforeUpdate event to validate the records and alert the users of any
errors or invalid data before allowing it to be saved. If you really
wanted, you still (and seem to have done so already) use the messagebox
to choose from Yes/No/Cancel and run the save code or cancel out of the
BeforeUpdate event.

Also, it kinds of sound like you want the "No" button to basically undo
the edits. If so, just use Me.Undo for the No case. This should then
clear the dirty flag as well cancel any pending edits. Is that what you
meant?
Help! how can Me.Dirty be cleared without causing the record to be saved.
In my Form_BeforeUpdate (or wherever is best), when a record is Dirty, I
[quoted text clipped - 20 lines]
Anyone have a good example I could follow
Thanks all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top