We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Undo changes

stathisx
stathisx asked
on
Medium Priority
536 Views
Last Modified: 2013-11-05
Hello experts ,
i have a problem with ms access 2010.I am using navigation control and each tab opens a single form.What i want to do is that when i am in a form and i enter the primary key value (fill data to an object for example a date object) i want if i point to another tab of the navigation control to be prompted if i want to save the record or not.If i choose no i want to discard changes . i have tried the code below in the unload and close events of the form and it didn't work .Am i missing something ?
If Me.Dirty Then
        MsgBox "changes discarded"
        RunCommand acCmdUndo
End If

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
you have to use the Beforeupdate event of each form or subform to trigger the message and to cancel the changes

Author

Commented:
can you please post a sample code to do that ?
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Capricorn comments were very good and helpfull to point me to the right direction.The complete solution though was by the code posted in the last comment.thank you !
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.