Board index » delphi » Access memo fields and TMemo

Access memo fields and TMemo

Hi,

    I have been struggling with this problem for a while.  Please forgive
me, I'm a 'newbie' =).  I have a memo component in my app, and memo field in
an access db that I want to dump the contents into.  I can't figure out any
way to get the contents of that memo box into the memo field of the
database.  I've read help files and books, but to no avail.  If anyone has
any suggestions for me, please let me know. (sample source would also really
help!)

thanks in advance

tm

 

Re:Access memo fields and TMemo


Quote
>     I have been struggling with this problem for a while.  Please forgive
> me, I'm a 'newbie' =).  I have a memo component in my app, and memo field
in
> an access db that I want to dump the contents into.  I can't figure out
any
> way to get the contents of that memo box into the memo field of the
> database.  I've read help files and books, but to no avail.  If anyone has
> any suggestions for me, please let me know. (sample source would also
really
> help!)

You can try something like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  m: TMemoryStream;
begin
  m := TMemoryStream.Create;
  try
    Memo1.Lines.SaveToStream(m);
    with Table1 do begin
      Edit;
      TBlobField(FieldByName('FieldName')).LoadFromStream(m);
      Post;
    end;
  finally
    m.Free;
  end;
end;

--
David Reed
Diamond Software Group, Inc
www.diamondsg.com
www.oasisrep.com

Re:Access memo fields and TMemo


Why not use a TDBMemo component?

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Re:Access memo fields and TMemo


Quote
> I have a memo component in my app, and memo field in
>an access db that I want to dump the contents into.  I can't figure out any
>way to get the contents of that memo box into the memo field of the
>database.

Table1.fieldbyName('YourMemo').Assign(MemoComponent.Lines );

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads