Board index » delphi » Not in edit or insert mode===> HELP

Not in edit or insert mode===> HELP

I'm trying to create an database application but i'm getting this error
message.  It halts on the area I marked.

I tried to put the Append Method on the mainform to change the mode to edit
mode (per what I understand on books), but nothing happens.  Kindly give me
solution (s).  Thanks in advance.

here's the portion my program stops:

program JobOrder;

uses
  Forms,
  mainform in '..\mainform.pas' {Main},
  datagroup in 'tables\datagroup.pas' {dmDatagroup: TDataModule},
  PasswordPop in 'PasswordPop.pas' {PasswordDlg},
  about in 'about.pas' {AboutBox},
  EditPop in 'EditPop.pas' {EditPopup};
{$R *.RES}

begin
  Application.Initialize;
  Application.Title := 'JOB TICKET';
  Application.CreateForm(TMain, Main);
  Application.CreateForm(TPasswordDlg, PasswordDlg);   {=====HERE=====}
  Application.CreateForm(TAboutBox, AboutBox);
  Application.CreateForm(TdmDatagroup, dmDatagroup);
  Application.CreateForm(TEditPopup, EditPopup);
  Application.Run;
end.

 

Re:Not in edit or insert mode===> HELP


Somewhere in your Main form you are changing values of data field without
putting it in edit mode by calling Edit, Insert or Append method (Append
method is same as insert only it 'inserts' empty record at the end of a
table).

You should send a part of Main form where you are accessing fields for us
to locate the problem but for now:

before first statement that looks like:
        Table1.FieldsByName('FieldName').Value := SomeValue;
        or
        Table1Fieldname.Value := SomeValue;
        insert something like:
        if Table1.State in [dsEdit, dsInsert] then
          Table1.Edit;   // instead of Edit you can use Insert or Append if you
wish to add a new record

This piece of code checks if table is in Edit or Insert mode and if it's
not then puts it in one.

Hope it helps

Lucijan;        

ONIX143 <onix...@aol.com> wrote in article
<19991105021520.04095.00001...@ng-ff1.aol.com>...

Quote
> I'm trying to create an database application but i'm getting this error
> message.  It halts on the area I marked.

> I tried to put the Append Method on the mainform to change the mode to
edit
> mode (per what I understand on books), but nothing happens.  Kindly give
me
> solution (s).  Thanks in advance.

> here's the portion my program stops:

> program JobOrder;

> uses
>   Forms,
>   mainform in '..\mainform.pas' {Main},
>   datagroup in 'tables\datagroup.pas' {dmDatagroup: TDataModule},
>   PasswordPop in 'PasswordPop.pas' {PasswordDlg},
>   about in 'about.pas' {AboutBox},
>   EditPop in 'EditPop.pas' {EditPopup};
> {$R *.RES}

> begin
>   Application.Initialize;
>   Application.Title := 'JOB TICKET';
>   Application.CreateForm(TMain, Main);
>   Application.CreateForm(TPasswordDlg, PasswordDlg);   {=====HERE=====}
>   Application.CreateForm(TAboutBox, AboutBox);
>   Application.CreateForm(TdmDatagroup, dmDatagroup);
>   Application.CreateForm(TEditPopup, EditPopup);
>   Application.Run;
> end.

Re:Not in edit or insert mode===> HELP


Quote
Lucijan Sulic <luci...@altavista.net> wrote in message

news:01bf276d$ebf9d300$6806a8c0@lsulic...

Quote
> Somewhere in your Main form you are changing values of data field without
> putting it in edit mode by calling Edit, Insert or Append method (Append
> method is same as insert only it 'inserts' empty record at the end of a
> table).

> You should send a part of Main form where you are accessing fields for us
> to locate the problem but for now:

> before first statement that looks like:
> Table1.FieldsByName('FieldName').Value := SomeValue;
> or
> Table1Fieldname.Value := SomeValue;
> insert something like:
> if Table1.State in [dsEdit, dsInsert] then

if not (Table1.State in [dsEdit, dsInsert])
Quote
>   Table1.Edit;   // instead of Edit you can use Insert or Append if you
> wish to add a new record

> This piece of code checks if table is in Edit or Insert mode and if it's
> not then puts it in one.

> Hope it helps

> Lucijan;

> ONIX143 <onix...@aol.com> wrote in article
> <19991105021520.04095.00001...@ng-ff1.aol.com>...
> > I'm trying to create an database application but i'm getting this error
> > message.  It halts on the area I marked.

> > I tried to put the Append Method on the mainform to change the mode to
> edit
> > mode (per what I understand on books), but nothing happens.  Kindly give
> me
> > solution (s).  Thanks in advance.

> > here's the portion my program stops:

> > program JobOrder;

> > uses
> >   Forms,
> >   mainform in '..\mainform.pas' {Main},
> >   datagroup in 'tables\datagroup.pas' {dmDatagroup: TDataModule},
> >   PasswordPop in 'PasswordPop.pas' {PasswordDlg},
> >   about in 'about.pas' {AboutBox},
> >   EditPop in 'EditPop.pas' {EditPopup};
> > {$R *.RES}

> > begin
> >   Application.Initialize;
> >   Application.Title := 'JOB TICKET';
> >   Application.CreateForm(TMain, Main);
> >   Application.CreateForm(TPasswordDlg, PasswordDlg);   {=====HERE=====}
> >   Application.CreateForm(TAboutBox, AboutBox);
> >   Application.CreateForm(TdmDatagroup, dmDatagroup);
> >   Application.CreateForm(TEditPopup, EditPopup);
> >   Application.Run;
> > end.

Re:Not in edit or insert mode===> HELP


You are addressing tables/queries on your datamodule, isn't it? Move
the creation of TdmDatagroup up before TMain.

Have fun!

Jasper

On 05 Nov 1999 07:15:20 GMT, onix...@aol.com (ONIX143) wrote:

Quote
>I'm trying to create an database application but i'm getting this error
>message.  It halts on the area I marked.

>I tried to put the Append Method on the mainform to change the mode to edit
>mode (per what I understand on books), but nothing happens.  Kindly give me
>solution (s).  Thanks in advance.

>here's the portion my program stops:

>program JobOrder;

>uses
>  Forms,
>  mainform in '..\mainform.pas' {Main},
>  datagroup in 'tables\datagroup.pas' {dmDatagroup: TDataModule},
>  PasswordPop in 'PasswordPop.pas' {PasswordDlg},
>  about in 'about.pas' {AboutBox},
>  EditPop in 'EditPop.pas' {EditPopup};
>{$R *.RES}

>begin
>  Application.Initialize;
>  Application.Title := 'JOB TICKET';
>  Application.CreateForm(TMain, Main);
>  Application.CreateForm(TPasswordDlg, PasswordDlg);   {=====HERE=====}
>  Application.CreateForm(TAboutBox, AboutBox);
>  Application.CreateForm(TdmDatagroup, dmDatagroup);
>  Application.CreateForm(TEditPopup, EditPopup);
>  Application.Run;
>end.

Other Threads