I'm stuck and need advise - cannot fix Record/Key Deleted 
Author Message
 I'm stuck and need advise - cannot fix Record/Key Deleted

Hi,
I have a TDBGrid, TDataSource and TTable on a form. I created a Paradox
table with DataBase Desktop. The table has three fields. I set field[0], a
numeric field,  to be a key field that I want to set during with calculated
data from another field.

The key field is not displayed in the grid - I am just using it to keep the
data sorted in the grid.

Everything works fine when I insert a new  record, but when I edit an
existing record I get a Record/Key Deleted error message. If I click OK on
the error message box the data posts OK and all is good. I just need to get
rid of the annoying error message.

I am setting the key field from within the BeforePost event handler. I have
also tried the LeaveColum and other event handlers and they all work the
same with the same problem. I have tried setting the field data with the
SetFields method and by accessing the fields directly; they both have the
same problem.

If I remove the "key" attribute from field[0] the error does not occur. But
then the data displayed in the grid is not sorted after post. Is there a
Sort method for tables? I cannot find it. If there is a Sort method I could
forget the key field and sort the table afterwards.

I cannot see what I am doing wrong here. Can anybody help?

Thanks,
Tim



Mon, 19 Apr 2004 00:32:38 GMT  
 I'm stuck and need advise - cannot fix Record/Key Deleted

Try setting the key in the OnInsert event.

...Jim

Quote:

> Hi,
> I have a TDBGrid, TDataSource and TTable on a form. I created a Paradox
> table with DataBase Desktop. The table has three fields. I set field[0], a
> numeric field,  to be a key field that I want to set during with calculated
> data from another field.

> The key field is not displayed in the grid - I am just using it to keep the
> data sorted in the grid.

> Everything works fine when I insert a new  record, but when I edit an
> existing record I get a Record/Key Deleted error message. If I click OK on
> the error message box the data posts OK and all is good. I just need to get
> rid of the annoying error message.

> I am setting the key field from within the BeforePost event handler. I have
> also tried the LeaveColum and other event handlers and they all work the
> same with the same problem. I have tried setting the field data with the
> SetFields method and by accessing the fields directly; they both have the
> same problem.

> If I remove the "key" attribute from field[0] the error does not occur. But
> then the data displayed in the grid is not sorted after post. Is there a
> Sort method for tables? I cannot find it. If there is a Sort method I could
> forget the key field and sort the table afterwards.

> I cannot see what I am doing wrong here. Can anybody help?

> Thanks,
> Tim

  jim.vcf
< 1K Download


Mon, 19 Apr 2004 04:48:26 GMT  
 I'm stuck and need advise - cannot fix Record/Key Deleted
OnInsert works, but OnNewRecord would be the place Borland intended to place
this kind of code...


Quote:
> Try setting the key in the OnInsert event.

> ...Jim

[...]


Wed, 21 Apr 2004 03:48:22 GMT  
 I'm stuck and need advise - cannot fix Record/Key Deleted

M.H.

You are quite correct.  I don't know the order they are called or if there is
some type of append that might bypass OnInsert but using OnNewRecord would
provide better "self documentation" to supplement the always complete and
excellent documentation each and every one of us already places throughout every
one of their programs ;-)

Now where did I put those flow charts?

...Jim

Quote:

> OnInsert works, but OnNewRecord would be the place Borland intended to place
> this kind of code...



> > Try setting the key in the OnInsert event.

> > ...Jim
> [...]

  jim.vcf
< 1K Download


Wed, 21 Apr 2004 05:43:26 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. I'm stuck and need advise - cannot fix Record/Key Deleted

2. 'Record/Key Deleted' Exception

3. D2: EDBEngineError: 'Record/key deleted'

4. Need help on "Record/Key deleted"

5. Cannot delete or edit record using Delphi 2.01, Personal Oracle, ODBC

6. 'Record/Key deletes' error message, though record exist

7. data aware grid and table - record/key deleted

8. Record/key delete Error???

9. record/key deleted error

10. EdbEngineError - Record/Key deleted

11. <Help> Record Key Deleted

12. Record/Key Deleted Problems w/Paradox

 

 
Powered by phpBB® Forum Software