A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Close Form Event



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old June 5th, 2010, 04:03 AM posted to microsoft.public.access
PeterM
external usenet poster
 
Posts: 208
Default Close Form Event

I have a AC2003 bound form. The condition I'm trying to capture is if the
user modifies any item on the form and they close the form without saving
changes. Simple...right? I found out that Form_Close doesn't work so I
tried the following code in the Form_Unload event and that isn't working
either. It does not even trigger the event. Can someone please tell me what
I'm doing wrong? I would be much appreciated.

Private Sub Form_Unload(Cancel As Integer)
If Me.btnSave.Enabled Then
Dim strMsg As String
strMsg = strMsg & "Save Changes?" & Chr(13) & Chr(13)
If MsgBox(strMsg, vbQuestion + vbYesNo, "Please Confirm!") = vbYes
Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Else
Cancel = True
End If
End If
End Sub

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.