I know I should have found a good book by now, but the selection available to me is rather limited (not to mention non existent in the “not really a programmer but don’t need screenshots of dialogue boxes thanks” department), so I hope some kind soul will help me out.
I want to attach a procedure to a form that prevents the user exiting that form and puts up a message box warning him or her that certain tasks have not been completed. I wish to use flags rather than required or validation properties as I need them to be set and reset from different parts of the form. I understand that I can use a BeforeUpdate procedure to do this, but I have 3 questions:
1) I assume that if all flags are down and the initial if condition of the procedure is not met, then after the procedure exits the other update events continue as normal, and the record is saved. Is this not the case? Do I have to force a save?
2) What happens if the user tries to close the form? I have had a similar problem with an error trapping mechanism on another field – if the form is closed, the message box appears, but when OK is clicked on, the form closes anyway, rather than staying open and directing the user to the field in question.
3) If a flag is up, and the user is directed back to the form, I assume all the recent changes are preserved, but not saved until the record is exited.
I’m afraid online help has rather deserted me with a lack of examples in this regard.
A related question – is there an update property that can be accessed, for instance if one wants to run some code on a control being exited, but one of many conditions to decide whether to execute a block is whether that control has been updated, is there a property that can be read, rather than having one block attached to some conditions on exit (ie to be assessed even if there has been no update), and the same block in a before or after update procedure. It would also be nice to confirm update=false. At present I do this by comparing control value with control.oldvalue, but it’s rather cumbersome.
Thanks
Mark