Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread removing line breaks in 'edit' mode
Fri, Jun 16 2006 3:47 PMPermanent Link

AAA
Hi, I have a few dbisam tables that are connected to some grids.  When a user selects a record in the grid and presses the 'edit' button it shows them an editting form which is used to
edit the information in the record.  However, after editting a value in the record, a line break is added to the end of the editted field.

my (onclick)  code for the editting is:
  dtmMain.qryTeam.Edit;
  dtmMain.qryTeamEmployeeName.AsString := frmaddemployee.dlgLookUpEmployee.Text;
  dtmMain.qryTeamDesk.AsString := frmaddemployee.dlgLookUpDesk.Text;
  dtmMain.qryTeamRole.AsString := frmaddemployee.dlgLookUpRole.Text;
  dtmMain.qryTeamTeamNotes.AsString := frmaddemployee.memNotes.Lines.GetText;
  dtmMain.qryTeam.Post;

Is this not the right way to do it?  If I insert a new record using (dtmMain.qryTeam.Insert) there is no problem, but then I lose the ID value from the original record.
Although the line breaks are invisible to the record values themselves, when I want to export the grid to a 'quickreports' file, the line breaks show up and I have a few records with some
extra spaces between.


Thanks
Fri, Jun 16 2006 6:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Hi, I have a few dbisam tables that are connected to some grids.  When a
user selects a record in the grid and presses the 'edit' button it shows
them an editting form which is used to edit the information in the record.
However, after editting a value in the record, a line break is added to the
end of the editted field.

my (onclick)  code for the editting is:
  dtmMain.qryTeam.Edit;
  dtmMain.qryTeamEmployeeName.AsString :=
frmaddemployee.dlgLookUpEmployee.Text;
  dtmMain.qryTeamDesk.AsString := frmaddemployee.dlgLookUpDesk.Text;
  dtmMain.qryTeamRole.AsString := frmaddemployee.dlgLookUpRole.Text;
  dtmMain.qryTeamTeamNotes.AsString :=
frmaddemployee.memNotes.Lines.GetText;
  dtmMain.qryTeam.Post;

Is this not the right way to do it? >>

Did you try using Assign instead ?

my (onclick)  code for the editting is:
  dtmMain.qryTeam.Edit;
  dtmMain.qryTeamEmployeeName.AsString :=
frmaddemployee.dlgLookUpEmployee.Text;
  dtmMain.qryTeamDesk.AsString := frmaddemployee.dlgLookUpDesk.Text;
  dtmMain.qryTeamRole.AsString := frmaddemployee.dlgLookUpRole.Text;
  dtmMain.qryTeamTeamNotes.Assign(frmaddemployee.memNotes.Lines);
<<<<<<<<<<
  dtmMain.qryTeam.Post;

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Jun 19 2006 2:03 PMPermanent Link

AAA
Tim, I tried the assign:
dtmMain.qryTeamTeamNotes.Assign(frmAddEmployee.memNotes.Lines);

however, an error pops up saying "Cannot assign a TMemoStrings to a TStringField'

Any ideas how to fix this?





"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

<< Hi, I have a few dbisam tables that are connected to some grids.  When a
user selects a record in the grid and presses the 'edit' button it shows
them an editting form which is used to edit the information in the record.
However, after editting a value in the record, a line break is added to the
end of the editted field.

my (onclick)  code for the editting is:
  dtmMain.qryTeam.Edit;
  dtmMain.qryTeamEmployeeName.AsString :=
frmaddemployee.dlgLookUpEmployee.Text;
  dtmMain.qryTeamDesk.AsString := frmaddemployee.dlgLookUpDesk.Text;
  dtmMain.qryTeamRole.AsString := frmaddemployee.dlgLookUpRole.Text;
  dtmMain.qryTeamTeamNotes.AsString :=
frmaddemployee.memNotes.Lines.GetText;
  dtmMain.qryTeam.Post;

Is this not the right way to do it? >>

Did you try using Assign instead ?

my (onclick)  code for the editting is:
  dtmMain.qryTeam.Edit;
  dtmMain.qryTeamEmployeeName.AsString :=
frmaddemployee.dlgLookUpEmployee.Text;
  dtmMain.qryTeamDesk.AsString := frmaddemployee.dlgLookUpDesk.Text;
  dtmMain.qryTeamRole.AsString := frmaddemployee.dlgLookUpRole.Text;
  dtmMain.qryTeamTeamNotes.Assign(frmaddemployee.memNotes.Lines);
<<<<<<<<<<
  dtmMain.qryTeam.Post;

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Jun 19 2006 3:09 PMPermanent Link

"Ralf Mimoun"
AAA wrote:
> Tim, I tried the assign:
> dtmMain.qryTeamTeamNotes.Assign(frmAddEmployee.memNotes.Lines);
>
> however, an error pops up saying "Cannot assign a TMemoStrings to a
> TStringField'
>
> Any ideas how to fix this?

dtmMain.qryTeamTeamNotes.Asstring := frmAddEmployee.memNotes.Text;

Ralf
Mon, Jun 19 2006 3:10 PMPermanent Link

"Ralf Mimoun"
Oh, I see.

AAA wrote:
> Tim, I tried the assign:
> dtmMain.qryTeamTeamNotes.Assign(frmAddEmployee.memNotes.Lines);
>
> however, an error pops up saying "Cannot assign a TMemoStrings to a
> TStringField'
>
> Any ideas how to fix this?

Use a memo field if you want to store multiline text.

Ralf
Tue, Jun 20 2006 3:51 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Tim, I tried the assign:
dtmMain.qryTeamTeamNotes.Assign(frmAddEmployee.memNotes.Lines);

however, an error pops up saying "Cannot assign a TMemoStrings to a
TStringField'

Any ideas how to fix this? >>

As Ralf said, use a TMemoField (FieldType=ftMemo) if you want to store
multi-line text.  Using a string field will simply cause issues with the way
the CR/LFs are handled when loading/storing the text to and from the TMemo
using AsString.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image