me.dirty stop from closing form

scopes456

Registered User.
Local time
Yesterday, 20:47
Joined
Feb 13, 2013
Messages
89
Is if possible having a me.dirty event in the before_update field,and when you click no, it does not close the current form.

If Me.Dirty Then
If MsgBox("would you like to continue", vbYesNo, "JFK-CONTRACT FORM") = vbNo Then


After the "=vbNo" what can i put for it to just close the msg box, so i can add changes to the current form, instead of it closing.
 
I think you'll need to post more code in order to see how the current form is being closed.
"what can i put for it to just close the msg box"
These close automatically when you click Yes/No/Cancel, but we need to see what code is executing after the Msgbox code

David
 
... and I don't see anywhere where you're closing the form.

Can you elaborate on what you're trying to do + more code (like DavidAtWork requested).
 
Thank You for responding, the code i am using on the before_update is

If Me.Dirty Then
If MsgBox("Submit Contract Form? Clicking No Log You Off", vbYesNo, "JFK-CONTRACTS") = vbNo Then
Me.Undo
Cancel = True
End If
End If
End Sub

this code works perfect when the user enter the correct information, but i was wondering if someone makes a mistake and realize that they did after selecting submit, is there a way when the user selects "no" instead of it closing the form, it keeps the form open so they can enter new data.
 
is there a way when the user selects "no" instead of it closing the form, it keeps the form open so they can enter new data.
I still don't see how this relates to closing a form. Do you mean that the code fires when you're closing a dirty form? Can you clarify this.
 
vbaInet, i just realize that i am using the code wrong. The code right now is set to run when i am closing a dirty form, i think i need to set it where a command button runs the code, then closes the form.
 
scopes let's forget about code for now. You still haven't clearly conveyed what you want to do.

What I would like to know is something like this:
A user clicks a Submit button, if they select vbYes to the Msgbox it will submit the contract form and close the form. If the user selects vbNo to the Msgbox it will go back to the form and allow the user to make any extra changes.

Is this what you're trying to do?
 

Users who are viewing this thread

Back
Top Bottom