me.dirty with a bound form

  • Thread starter Thread starter Jordan C. Schroeder
  • Start date Start date
J

Jordan C. Schroeder

Hello Experts,

I am having an issue with a form that is bound to a table. There is a list
box at the bottom of the form that users can select a record they would like
to work with, and the bound text boxes automatically show the values for that
record. If the user changes something in the text box, and clicks the list
box again without hitting save, the changes get saved. I have tried using:

If Me.Dirty = True Then
'Undo changes:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

But for some reason Me.Dirty is always False, even if an unsaved change is
made. I thing I am missing something here, any assistance with this would be
greatly appreciated.

Thanks,
Jordan
 
(re-sending because my original reply hasn't appeared)

Jordan C. Schroeder said:
Hello Experts,

I am having an issue with a form that is bound to a table. There is a
list
box at the bottom of the form that users can select a record they would
like
to work with, and the bound text boxes automatically show the values for
that
record. If the user changes something in the text box, and clicks the
list
box again without hitting save, the changes get saved. I have tried
using:

If Me.Dirty = True Then
'Undo changes:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

But for some reason Me.Dirty is always False, even if an unsaved change is
made. I thing I am missing something here, any assistance with this would
be
greatly appreciated.


Are you sure the list box is not on a subform? If it is, the main form's
record will be always be saved before the subform, and hence the list box)
gets the focus.

If it's not on a subform, and you're sure you are modifying a bound, not an
unbound, text box, then I strongly suspect something else is forcing the
dirty record to be saved before the list box is clicked.
 
Thank you both very much for your replies. It looks like the me.undo in the
BeforeUpdate even took care of it.

Cheers!
 
Jordan C. Schroeder said:
Thank you both very much for your replies. It looks like the me.undo in
the
BeforeUpdate even took care of it.


You realize that's going to prevent the form from *ever* saving changes?
You'd need to code any updates to the underlying table yourself.
 
Back
Top