Board index » delphi » DBGrid -- edit and insert modes

DBGrid -- edit and insert modes

I wish to use the DBGrid object to allow
editing of records that exist in a table,
however I don't want the the user to append a
new record.

When I call up the form I set the table to
edit mode, however I can still append a new
record by pressing the down arrow key.
What is the easiest way to stop this ?

Thanks.

 

Re:DBGrid -- edit and insert modes


Peter,
I couldn't find a direct way, but found that this works, at least for
a grid attached to a query:

In the OnNewRecord event for the query, put a delete command:
tform.qMyqueryNewRecord(...);
begin
        qMyquery.delete;
end;

I haven't tried it, but qMyquery.abort in the BeforeInsert event might
work also.

hth,
Dan

On Mon, 16 Nov 1998 15:40:43 +0000, Peter Hunt

Quote
<peter.h...@casltd.co.uk> wrote:
>I wish to use the DBGrid object to allow
>editing of records that exist in a table,
>however I don't want the the user to append a
>new record.

>When I call up the form I set the table to
>edit mode, however I can still append a new
>record by pressing the down arrow key.
>What is the easiest way to stop this ?

>Thanks.

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control: Consulting, Software,
and the only comprehesive textbook on this subject.
visit us at www.cmdcsystems.com
[Remove the SPAM from my e-mail address]

Other Threads