Tip of the Month (April 2004) Preventing "Ghost" Records Whenever a Visual CE form is running, it is positioned on a record. If, when the form comes up, there are no records in the table, Visual CE creates a new record (using the default values). While running a form, if you delete all the records in the table, Visual CE creates a new record (using the default values). Immediately after this record is created, the user may close the application. When this happens, a "ghost" record will be left in the table. Here's how to avoid this problem: Say one of your columns is called NAME with an empty string as the default value. In the edit control over the NAME column, set the minimum length to 1 (minimum length is one of the properties of the edit control). If a record gets created and, without changing the value of NAME, the user tries to close the form, Visual CE will detect that NAME as too short. Visual CE will put up a message ("Value of NAME missing") and the user will be given the opportunity to delete the record. The only way the user can close the application is if they delete the record. You can use this technique with:
By the way, if you have a macro with either these two commands:
or these three commands:
when the form closes, there will be no records in the table when the form closes. |