Copy from one table to another

How do I copy an contents from an active grid? I would like when a user selects a particular value on a grid, it copies the information to another table. How do I go about that?

Hello, what do you think about a button named “transfer data” and on the method cliked() put the code that transfer data from the current record to the table you want ? I don’t think it’s a lot of code. Regards.

I am not sure about the code. How would I code it. Using the args object? Do you have an example of such a method to transfer data.

Do you just want to copy current record to another table? it is easy. override the event of mouseDBClick; just like the following sample codes. public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift) { int ret; CopyToTablename CopyToTablename; ; ttsbegin; currentTable.field1=CopyToTablename.field1; currentTable.field2=CopyToTablename.field2; currentTable.field3=CopyToTablename.field3; //… CopyToTablename.insert(); ttscommit; ret = super(_x, _y, _button, _Ctrl, _Shift); return ret; } wish the above codes can give you some help.

Thanks much. It worked like a charm but how to I refresh the data on the new form where the data was copied into to? When it is refreshed, I would like it to point to the newly inserted record. I am baffled on which method to use to do that.

You can put the following code after ttscommit to refresh data immediately. CopyToTablename_ds.executeQuery(); It would be helpful I think.