Selasa, 02 Oktober 2012

RE: [MS_AccessPros] Prompt user whether they want to save changes when the form's close

 

This code goes in the Before Update Event

The Close Event happens after the update is completed so the form is not
dirty anymore.

Bob Peterson

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of saigonf7q5
Sent: Tuesday, October 02, 2012 1:30 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Prompt user whether they want to save changes
when the form's close

I have been trying to display a message to ask the user whether they
want to save changes they made to the record, before they close the
form. I stepped through the Form_Close event, but the If Me.Dirty
stament has never become true after the data in a control (text box) was
changed? Why is that?

Private Sub Form_Close()
If Me.Dirty Then
Call Response
End If
End Sub

Sub Response()
intResponse = MsgBox("Save changes? Yes/No", vbYesNo, "Save Record")
If intResponse = vbYes Then
Call SaveChanges
ElseIf intReply = vbNo Then
Call UndoTyping
End If
End Sub

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar