My Assistant
![]() ![]() |
|
|
Jul 5 2007, 04:02 PM
Post
#1
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi
In the attached Dbase the main form that opens has a button with text "Example Yes/No/Cancel" How can I use this button so that a. whenever changes have been made to data. It will prompt with the message "Do you want to Save the Changes?" User can then choose either of the Options Yes/No / Cancel Yes will save the data and move to next record No will keep the original data and move to the next record Cancel will keep the original data and move to the next record Can this be done? Your help appreciated Mike
Attached File(s)
|
|
|
|
Jul 5 2007, 04:18 PM
Post
#2
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
I would put the code in the Forms Before Update event so it will fire no matter how the user decides to leave the form.
If Me.Dirty Then Select Case MsgBox("Do you want to Save Changes!", vbYesNoCancel Or vbDefaultButton1 Or vbExclamation, "Title: Click Yes, No Or Cancel!") Case vbYes 'do nothing Case vbNo Me.Undo Case vbCancel Me.Undo End Select End If This is completely and totally UNTESTED so BEWARE! Jack |
|
|
|
Jul 5 2007, 04:27 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi Jack
You are too good - That works fine How do I make it go to the next record after they have chosen their option? Mike |
|
|
|
Jul 5 2007, 04:34 PM
Post
#4
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
Mike -
I do not know how your form is set up, but usually they will tab through the form and it will go to the next record when they exit the last control, at which time the Before Update event will fire. It should go to the next record... REMEMBER! All of this is UNTESTED and coming from my fevered brain... Jack |
|
|
|
Jul 5 2007, 04:56 PM
Post
#5
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi Jack
Your fevered brain is working like clockwork It works a treatMany thanks once again Mike |
|
|
|
Jul 5 2007, 05:03 PM
Post
#6
|
|
|
Utterly Banned Posts: 7,038 |
QUOTE I do not know how your form is set up, but usually they will tab through the form and it will go to the next record when they exit the last control, at which time the Before Update event will fire. This is not quite accurate. The Before Update event does NOT fire unless the form is dirty. If the form is not dirty then the Before Update event does not fire so be careful in how you use it. Also, if you use the Before Update event, you don't have to test to see if it is dirty in the Before Update event. So the earlier code about If Me.Dirty Then... is redundant and not required. |
|
|
|
Jul 5 2007, 05:05 PM
Post
#7
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
Mike -
You are most welcome and thank goodness for small favors! Glad to hear that my fevered brain was/is working... Tis 39.5C today.... PHEW! Jack |
|
|
|
Jul 5 2007, 05:07 PM
Post
#8
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
Bob -
Very 'cool' information! Thank you for sharing it....now all I have to do is find some spare room in my memory banks in which to save it... So much yet to learn and so little time left... Jack |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th June 2013 - 05:46 PM |