Prevent save but allow edit?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1290

    Prevent save but allow edit?

    How do you prevent a save from being done on a form but still allow editing of the form? I have a form that I use to collect information and then I save various pieces of it here and there in the code-behind on a button-click for 'Save'. But if the user navigates to another record there is an auto-save that happens and I don't want that.

    If I cancel the save in the form's before update event it prevents the navigation from completing.

    Thanks,

    Jim
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3655

    #2
    Jim,

    One way to check to see if a record has been changed is the
    Code:
    Me.Dirty
    property. Prior to allowing the navigation to a new record, check to see if the record has been changed. If so, prevent the save, cancel the changes and then move.

    One possible way of doing this with your form may be to have a constant filter on the form, such that when one "navigates" to a record, you are merely identifying the record, and then filtering the form for that record (also, make sure that AllowAdditions is set to No). Then, the user is prevented from navigating to the next record (or an new record). when they want to navigate to another record, they click the "Next" button: You check for changes, cancel any of those, identify the next record, filter by it.

    Not the simplest method, but I've used similar constructions in the past--there might be easier ways to do this, too....

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1290

      #3
      Thanks, twinnyfo. Can't implement the filtering you suggest because of application demands; the recordset and count of records within are themselves valuable objects to the user, key to this particular app. I could clear the dirty flag and manually do the navigation ... hmmm, no, maybe not, not unless I remove the form's built-in navigation buttons and add my own.

      Thanks for the ideas. I'll add them to the mix while I ponder this.

      Comment

      Working...