Force user to select Save cmd

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GR82BBlondie
    New Member
    • Mar 2008
    • 3

    Force user to select Save cmd

    Have read several posts and it appears that forcing a user to use the "Save" cmd is not used. However, I have a situation with a main form that has three pages/tabs. Each page has a subform1 and a subform2 inside of the subform1, (subform2 is three deep basically). If a user navigates away to a different page or attempts to close the form, I want them to be warned they will lose all changes. OR they can select Save to exit the page gracefully. Any assistance would be greatly appreciated.

    Thank you.

    Blondie
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    In point of fact, unless you've explicitly done something to make this happen, it won't. Moving from one subform to another or from subform to main form will not result in the record on the form being lost, but rather it will be saved by default.

    If you want to force the user to explicitly save the record, you don't really need a "Save" button, you need to place code in each form's BeforeUpdate event that asks them if they want to save it or not:

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
     If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
      Me.Undo
     End If
    End Sub
    Welcome to Bytes!

    Linq ;0)>

    Comment

    Working...