BeforeUpdate

wazz

Super Moderator
Local time
Tomorrow, 03:49
Joined
Jun 29, 2004
Messages
1,702
how does one deal with three options? if it's YesNo, or OKCancel it's fine, but what about YesNoCancel? i would like to:

yes: carry on to the next record or form saving the update
no: carry on to the next record or form, but Me.Undo
cancel: stay on the same record without undoing anything

i keep getting caught in a loop that tests each if, each time, for some reason.

:rolleyes:
 
I set up my message boxes slightly differently, but find I have more control over the user response. Give the following code a try:

Code:
Dim Msg As String
Dim Title As String
Dim Result As Integer

Msg = "Write message here"
Title = "Title of Database"
Result = MsgBox(Msg, 35, Title) 'Question mark with Yes/No/Cancel buttons

If Result = 6 Then 'User selects Yes
   Carry on to next record, save update
ElseIf Result = 7 Then 'User selects No
   Carry on to next record, do not save update
End If

HTH
 
Thanks to both!
w
 
before update, part II

the suggestions for the before update code are working when i attempt to move through the records (forward or backward) of a form via the navigation buttons. but when i attempt to go "Back" to a previous form via a command button, the Cancel option does not work, i.e., the form i am on, which has been updated and needs to be validated ("Save Changes?") closes (and i move to the next form) whether i choose yes (which it should), no (which it should) or cancel (which it shouldn't). i've been reading up on events and the order of events, among other things, but still can't get cancel to work under these circumstances. there seems to be a conflict of interest between the code on the cmdButton and the form's before update that i can't negotiate. w.
 

Users who are viewing this thread

Back
Top Bottom