Results 1 to 2 of 2

Thread: Yes, no cancel for a save?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Question

    You know when you close a window in word or something, it ask you if you want to save, and it say yes, no and cancel, how do i do that?

  2. #2
    Guest
    Put this at the beginning:

    Code:
    Public Saved As Boolean
    and this in EVERY save command inside a successful save:

    Code:
    Saved = True
    also:

    Code:
    Private Sub Control_Change()
      Saved = False
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Boolean)
      Dim x As Integer
      If Saved = False Then
        x = MsgBox("Do you want to save before closing?", vbExclaimation + vbYesNoCancel)
        If x = vbYes then
          mnuSave_Click (or another saving proc)
          Saved = True
        End If
      End If
      If x = vbCancel Then Cancel = True
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width