My Assistant
![]() ![]() |
|
|
Jan 25 2006, 08:17 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 59 |
hello,
i wanted my form to prompt the user if he wants to save the data he input if there is any when he wants to close the form...any ideas how i can go around doing this? |
|
|
|
Jan 25 2006, 08:35 PM
Post
#2
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
You can use code similar to this in a command button that will close the form. Be sure and remove the X in the upper right of the form so that user has to use your command button to close the form:
CODE If Me.NewRecord Then
Select Case MsgBox("Do you want to save this record?", vbYesNo Or vbExclamation Or vbDefaultButton1, Application.Name) Case vbYes 'do nothing Case vbNo Me.Undo End Select End If DoCmd.Close There are a lot of ways to skin this particular Access cat and this is just one of them... hth, Jack |
|
|
|
Jan 27 2006, 11:18 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 59 |
thanxs jack...
|
|
|
|
Jan 28 2006, 09:18 AM
Post
#4
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
You are welcome...
Jack |
|
|
|
Jan 28 2006, 11:32 AM
Post
#5
|
|
|
UtterAccess Member Posts: 20 From: Chandigarh (India) |
Hi,
I figure there is no use saving a new record if it isn't dirty. So in Jack's solution may be you can substitute "If Me.NewRecord Then" line with "If Me.Dirty Then". Jaspal Singh. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 12:02 PM |