Can someone please give me a straight ahead example of how I would use this trigger to prevent a form from closing? I get the impression that I must raise an error in this trigger, but if I do that aren’t all my user’s changes rolled back? All I want to test is the validity of the combination of two fields on the customer card (both must be blank or filled in). I want the user to correct this, and I want to keep the form open so they can correct it, but if I have to raise an error and ALL their changes are undone I will have very unhappy users!!! Thanks Devin W. McMahon, MCDBA

If the trigger contains “EXIT(FALSE)” it will not close…

For all those in the UK, heres a Blue Peter , for the benefit of everyone else, Here’s on I created earlier. OnQueryCloseForm() : Boolean IF “Date Sent”=0D THEN ERROR(‘Date sent cannot be left blank’); IF “Time Sent”=0T THEN ERROR(‘Time sent cannot be left blank’); This works on the principle, that if either of these two fields are blank, then the form will not close. However, if the user goes to the next or previous record, then these rules may no longer apply and the code could be ignored, thus the user can “Get Around” all your hard work. My suggestion to this would be to add similar code to the OnNextRecord() trigger. Hope this helps. Dean

This kind of traping is usually like chasing the wind. The user can easily get around it by switching records (yes I have seen it done). Also, be carefull you don’t put the user in a deadlock situation. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

Ways of skipping those “bullet proof” non-error systems: - Changing to another record. - Closing the application by using the task manager. - Closing the application by turning-off the computer. Another secoundary effect is… what’s happening if there are no records in the table and the user enters that form just for looking for something (not entering data) and starts trying to leave that form without entering any data?.. he becomes trapped. Regards Alfonso Pertierra (Spain)apertierra@teleline.es

The fact that the standard application does not - as far as I’m aware - use this trigger in any of its objects should give us at least a clue about the trigger’s usability, wouldn’t you say? Kind regards, Jan Hoek Weha Automatisering BV Woerden - The Netherlands

I would not use OnQueryCloseForm for this. We have several cases where we need to cross check one field against another. Put the coding with an ERROR statement into the OnInsert and OnModify triggers on the Table. This gets around problems of not checking when moving onto next record, etc.

I have another small question concerning this trigger: Is it just a problem at my computer or is this trigger executed after the form is closed, if the form is a request form for a report?

Hi Devin If i understoos your requirement correctly the try this code snippet on the ‘OnQueryclosefrom’ trigger eg: IF Name = ''THEN BEGIN MESSAGE(‘enter values for name field’) ; EXIT(FALSE); END; th above code i have written for customer card as eg… remember that if you happen to enter all the values and not the requird filed(s) and try to close the form it shows you the message and not allow you to close the form with the rest of the data remaining as eneterd by the user. hope this helps you. Kumar