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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Save prompt is not working



 
 
Thread Tools Display Modes
  #1  
Old January 25th, 2010, 05:24 PM posted to microsoft.public.access.forms
Ashley
external usenet poster
 
Posts: 189
Default Save prompt is not working

I have the embeded macro onClick event to close the form and set save to
prompt. But it didn't prompt when it close the form.
I also have below event in my form and it still not prompting to save. What
I need to check? Thanks
Private Sub Form_BeforeUpdate(Cancel As Integer)
'get user confirmation of whether to save record or not
If MsgBox("Do you want to save the new BOM?", vbYesNo) = vbNo Then
Me.Undo
Cancel = True
End If
End Sub
  #2  
Old January 25th, 2010, 09:02 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Save prompt is not working

If you use the line Cancel = True in the before update event, the form will
not close.
I suggest you put a close button with code something like this

Private Sub cmdClose_Click()
If Me.Dirty = True Then
If MsgBox("Do you want to save the new BOM?", vbYesNo) = vbNo Then
Me.Undo
Else
'other code here if needed to check data before save
End If
End If
DoCmd.Close acForm, Me.Name
End Sub


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Ashley" wrote in message
news
I have the embeded macro onClick event to close the form and set save to
prompt. But it didn't prompt when it close the form.
I also have below event in my form and it still not prompting to save.
What
I need to check? Thanks
Private Sub Form_BeforeUpdate(Cancel As Integer)
'get user confirmation of whether to save record or not
If MsgBox("Do you want to save the new BOM?", vbYesNo) = vbNo Then
Me.Undo
Cancel = True
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 05:44 PM.


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