Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Dataset not in Edit or insert mode


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Aug 12, 2016 2:29 PM Last Post By: canice pierre
canice pierre

Posts: 48
Registered: 9/27/12
Dataset not in Edit or insert mode  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 12, 2016 8:55 AM
The said table accepts items after a prior Append command but when POST is issued it comes up with the error. It happened before and I can't remember the solution.

Even after code was added to ensure edit mode, the error persists.

DM.ToDate_Table.ACTIVE:=true;
DM.ToDate_Table.Append;
DM.ToDate_Table.FieldByName('FULL_NAME').Value := DM.ComputeTaxTable.fieldbyName('FULL_NAME').value; * no error*
DM.ToDate_Table.FieldByName('COMPANY_NAME').Value := DM.ComputeTaxTable.fieldbyName('COMPANY_NAME').value; * no error*

if not (DM.ToDate_Table.DataSource.DataSet.State in [dsEdit, dsInsert]) then
begin
DM.ToDate_Table.DataSource.DataSet.Edit;
DM.ToDate_Table.POST; * ERROR Dataset not in Edit or insert mode *
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Dataset not in Edit or insert mode
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 12, 2016 9:51 AM   in response to: canice pierre in response to: canice pierre
canice pierre wrote:
The said table accepts items after a prior Append command but when POST is issued it comes up with the error. It happened before and I can't remember the solution.

Even after code was added to ensure edit mode, the error persists.

DM.ToDate_Table.ACTIVE:=true;
DM.ToDate_Table.Append;
DM.ToDate_Table.FieldByName('FULL_NAME').Value := DM.ComputeTaxTable.fieldbyName('FULL_NAME').value; * no error*
DM.ToDate_Table.FieldByName('COMPANY_NAME').Value := DM.ComputeTaxTable.fieldbyName('COMPANY_NAME').value; * no error*

if not (DM.ToDate_Table.DataSource.DataSet.State in [dsEdit, dsInsert]) then
begin
DM.ToDate_Table.DataSource.DataSet.Edit;
DM.ToDate_Table.POST; * ERROR Dataset not in Edit or insert mode *

One thing you can do is add a BeforePost event on the dataset and then put a
breakpoint there. Sounds like you have an event that is causing it to post
early on edits, but not on inserts.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
canice pierre

Posts: 48
Registered: 9/27/12
Re: Dataset not in Edit or insert mode  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 12, 2016 2:29 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Jeff Overcash (TeamB) wrote:
canice pierre wrote:
The said table accepts items after a prior Append command but when POST is issued it comes up with the error. It happened before and I can't remember the solution.

Even after code was added to ensure edit mode, the error persists.

DM.ToDate_Table.ACTIVE:=true;
DM.ToDate_Table.Append;
DM.ToDate_Table.FieldByName('FULL_NAME').Value := DM.ComputeTaxTable.fieldbyName('FULL_NAME').value; * no error*
DM.ToDate_Table.FieldByName('COMPANY_NAME').Value := DM.ComputeTaxTable.fieldbyName('COMPANY_NAME').value; * no error*

if not (DM.ToDate_Table.DataSource.DataSet.State in [dsEdit, dsInsert]) then
begin
DM.ToDate_Table.DataSource.DataSet.Edit;
DM.ToDate_Table.POST; * ERROR Dataset not in Edit or insert mode *

One thing you can do is add a BeforePost event on the dataset and then put a
breakpoint there. Sounds like you have an event that is causing it to post
early on edits, but not on inserts.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Thanks for this. However I remembered I had linked the table just before it stopped working. I removed the Mastersource at design time and attached it at run-time instead and it worked.
Thanks again for responding.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02