Log In    |    Knowledge Base    |    4D Home
Tech Tip: Deleting from a Subform
Published On: April 2, 1999

In version 3 of 4th Dimension, you could delete related records from an included layout using a no action button with a script behind it that called the DELETE RECORD command. In version 6, you can do this too, but any data validation may or may not work.

If the subform is set to selectable, you can select a record and click your no action button. If the subform is set to enterable however, this may not be all that you need to do, If you were to put a trace command in the delete button code, you would find that you have no current record in the related many table. Interestingly however, 4D knows which record to delete and does delete it. This is fine, unless you want to do some testing of values BEFORE you delete it. If this is the case, you will need to load the record first using the LOAD RECORD command. Once you do this, your data validation code should work fine. Also, don't forget to redraw the subform using the REDRAW command.