troubleshooting Question

How do I undo a field on a form using VBA?

Avatar of TerenceHewett
TerenceHewett asked on
Microsoft Access
2 Comments1 Solution273 ViewsLast Modified:
Hi experts,

I have a form called "Setup" and fields on the form.  One of these fields is called "DateFormat".  It is a combo box.  The format is either DD/MM/YYYY or MM/DD/YYYY.  When the user selects one of these options, and then clicks the "save" button, a msgbox pops up that states that the system needs to log off for these changes to take effect. Do you want to do this now? Yes/No.  

If the user selects "Yes" the system logs off with no problems.


If the user selects "No" then I need the DateFormat field to undo the last selection.  So if prior to selecting something from the DateFormat field the data showed "DD/MM/YYYY" and now the user has changed that to "MM/DD/YYYY", I would like to undo the last change and revert back to "DD/MM/YYYY".  I have tried the attached code in the "No" button of the msgbox, but nothing is working. Can anybody help?

Thank you.
Terry
Forms![Setup]![DateFormat].Undo

and 

Forms![Setup]![DateFormat] = Forms![Setup]![DateFormat].OldValue
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros