I have TFDQuery-->TDataSetDriverEh-->TMemTableEh-->TDBGridEh components in my form. In a MemTableEh connected to the DBGridEh, whenever the user adds a row (that is, a record) in MemTableEh, I want the program to automatically add a new record equal to it (except for the value of some of its fields) immediately, and so on. For example, if it has 3 fields: FirstName, LastName and Age fields, the new record generated by the program will have the record values entered by the user, except for Age field, which I want to be empty, for example, the user should enter the following record with the following values: First Name: Alan Last Name: Cole Age: 36 The generated record corresponding to it should be as follows: First Name: Alan Last Name: Cole Age: null
I used the AfterInsert event, one problem is that it got stuck in an infinite cycle because of recursive calls and adds infinite new records. What is the appropriate and optimal approach? Thanks
Last edited by rezap405 on 06 Sep 2024, 21:37, edited 3 times in total.
|