TerenceHewett
asked on
How do I undo a field on a form using VBA?
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Regards
Terry