Prompt for Saving Changes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an issue where sometime someone hits the close window button on the
Access form. It close completely and they are in the middle of entering data.

Does any one know of a way to prompt or send a message to confirm that you
wish to close. Could I use the keystroke intercept function to capture the
closing keystroke and generate a message the close based upon that logic???

Does any one know the window closing X key is (ascii)??


Thanks,

Gary
 
Rather than worry about how they closed it, simply put logic in the form's
Unload event. Set Cancel = True if you don't want the form to close.
 
Something like this might be useful:

'below from Access Advisor of March 2005 page 12
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Confirm w/ user that record should be updated
Dim strTemp As String
If Me.Dirty = True Then
strTemp = "Data has changed. Save Changes?"
If MsgBox(strTemp, vbYesNo + vbQuestion, _
"Please Confirm") = vbNo Then Cancel = True
'User has chosen not to save data:
Me.Undo
End If
End Sub

Bob Galway
 
I tried both methods of using the unload and the beforeUpdate event.

The problem is when the user hit the close button at the upper left hand
corner, it does something to my form when the cancel = true doesn't work.

The Me.undo doesn't work

Any help??


Gary
 
Back
Top