Using the technique mentioned in this thread: Creating Pseudo Custom Controls with Class Modules, I have successfully created my own set of form-navigation buttons, along with [Save] and [Undo] buttons.
However, there is a problem with the [Save] action. Each form has a different save criteria, like checking if all the required fields have data, trap duplicates in certain fields, or some forms have images in preview mode (in Temp folder) before save, and finally copying the images into destination folders when [Save] is committed.
It would not be a problem if I just put a universal DoCmd.RunCommand AcCmdSaveRecord in the [OnClick] event in the class module, and then attach the form-specific save-action code to the form's [OnClick] event of the save button, so that the form will commit those actions before getting to the Save code in the class module when the user clicks [Save].
But I have save actions not only in the click event of the [Save] button. When the user navigates the form out of the current record, say go to next record or close the form, I check if the form is dirty, and if so, pop a msgbox asking if the user wants to save before proceeding. This code will then have to be applied to every navigation button. And here comes the problem. How do I apply form-specific save actions to every single save event that's raised at class level?
This is really difficult to explain. I hope I made myself clear.
However, there is a problem with the [Save] action. Each form has a different save criteria, like checking if all the required fields have data, trap duplicates in certain fields, or some forms have images in preview mode (in Temp folder) before save, and finally copying the images into destination folders when [Save] is committed.
It would not be a problem if I just put a universal DoCmd.RunCommand AcCmdSaveRecord in the [OnClick] event in the class module, and then attach the form-specific save-action code to the form's [OnClick] event of the save button, so that the form will commit those actions before getting to the Save code in the class module when the user clicks [Save].
But I have save actions not only in the click event of the [Save] button. When the user navigates the form out of the current record, say go to next record or close the form, I check if the form is dirty, and if so, pop a msgbox asking if the user wants to save before proceeding. This code will then have to be applied to every navigation button. And here comes the problem. How do I apply form-specific save actions to every single save event that's raised at class level?
This is really difficult to explain. I hope I made myself clear.