Help: copy memo field from one table to another field
Quote
Mephist Kwan wrote:
> I want to copy memo field from tableA to memo field tableB. But the
> field name of source memo field is determined at runtime. So I use
> "FieldByName(variable).asstring" to get the value in that memo field.
> ('variable' is determined as runtime). However I don't how to copy
> that memo field data to another table.
> Showing "TableA.FieldByName(variable).asstring" gives me "(memo)",
> rather than the content. Besides, the following coding fails at
> runtime:
> "TableB.FieldByName('Memo').asstring := ...."
> Besides, "Assign" method of "TField" require parameter type of a
> "TPersistent" object !? (from online help: procedure Assign(Source:
> TPersistent);)
> Would anyone help me? Please email me some advice. Thanks in advance.
> Regards,
> Mephist
Mephist:
Use two dbmemo components - they could be hidden (visible=false), if
desired.
DBmemo2.Lines.Assign(DBmemo1.lines);
You MAY even be able to set the new field directly equal to the existing
one (i.e., without ".asstring"):
TableB.FieldByName('Memo'):=TableA.FieldByName(memoname);