Board index » delphi » Paradox Table not in edit mode - a Philosophy

Paradox Table not in edit mode - a Philosophy

I have been working on a database app for a while and keep running into the
'table not in edit on insert mode' etc. I know how to fix this by adding
Table1.Edit;
BUT, what I can't get my mind around is the philosophy of how this works. Do I
need to put the table into Edit mode in every procedure I define. What puts
the table back into browse mode apart from post? If I open a table on
Form.Activate, does it stay open until I say Form.Close? Will it stay open
even after the form has been closed?

If someone would explain the underlying working of controlling tables, I would
be grateful

Cheers

Glyn

Lost one and broke the other.

 

Re:Paradox Table not in edit mode - a Philosophy


In <4f5agj$...@hermes.is.co.za> gdav...@cirrus.co.za (Glyn Davies)
writes:

Quote

>I have been working on a database app for a while and keep running
into the
>'table not in edit on insert mode' etc. I know how to fix this by
adding
>Table1.Edit;
>BUT, what I can't get my mind around is the philosophy of how this
works. Do I
>need to put the table into Edit mode in every procedure I define. What
puts
>the table back into browse mode apart from post? If I open a table on
>Form.Activate, does it stay open until I say Form.Close? Will it stay
open
>even after the form has been closed?

>If someone would explain the underlying working of controlling tables,
I would
>be grateful

>Cheers

>Glyn

>Lost one and broke the other.

Anytime you move the cusrsor like in findkey etc the table goes into
browse mode.  Philosophically  this might be as aprotection against
modifying or adding records unwillingly.

Ben
Arrow

Re:Paradox Table not in edit mode - a Philosophy


Quote
gdav...@cirrus.co.za (Glyn Davies) wrote:
>I have been working on a database app for a while and keep running into the
>'table not in edit on insert mode' etc. I know how to fix this by adding
>Table1.Edit;

There is another way to handle this:

if Table1.State in [dsEdit, dsInsert] do
   Whatever()
else Exit;

Don't know if this is what you want, but I use it to detect if a TTable is in
edit- or insertmode and it works fine for me.

/Tomas
-----------------------------------------------------
 Tomas Matuschek
 University of Vaxjo, Sweden
-----------------------------------------------------

Re:Paradox Table not in edit mode - a Philosophy


Quote
gdav...@cirrus.co.za (Glyn Davies) wrote:
>I have been working on a database app for a while and keep running into the
>'table not in edit on insert mode' etc. I know how to fix this by adding
>Table1.Edit;
>BUT, what I can't get my mind around is the philosophy of how this works. Do I
>need to put the table into Edit mode in every procedure I define. What puts
>the table back into browse mode apart from post?

The table will be in Edit mode if you explicitly set it as in your
example, or if the user has started entering data and you have
AutoEdit on your DataSource set to true.  If you need to change the
contents of a field in your code this can be confusing, since you can
not assume that the table is in Edit mode.  The only solution that I
can suggest is to always preceed any changes to fields with
If not Table1.State in [dsInsert, dsEdit] then Table1.Edit;

After you Post your changes or move to another record (which also
posts your change) the table will be in Browse mode.

The only advantage I can see to having to set Edit mode explicitly is
that until the table is in Edit mode there are no locks against the
record, which would affect access in a multi-user environment.

Quote
>If I open a table on
>Form.Activate, does it stay open until I say Form.Close? Will it stay open
>even after the form has been closed?

I close my tables in the OnClose event procedure since the form still
exists after closing until it is Released.  This means that the table
component still exists.  Please notice that closing a table does not
automatically cause a Post.

Phil

Other Threads