Problem with AfterInsert Method, help needed... 
Author Message
 Problem with AfterInsert Method, help needed...

Hi,

Using D4 C/S P3, Paradox Tables, BDE 5.01.

I'm having a problem with records randomly appearing in a table with
no Job Number or Index Number (the Job Numer & Index Number are
assigned to the record in the AfterInsert Method.

When the user clicks the "New Record" button, it seems that in some
cases the AfterInsert Method is not being executed. This doesn't
happen often, but when it happens, the users cannot create any new
records because they get a Key Violation Error.

I haven't been able to track it down as yet and was wondering if
anyone else has seen the same problem.

Any help/advise would be great.

Many Thanks

Robbie...



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with AfterInsert Method, help needed...
After insert may be too late to add key fields. Can you put them in
the BeforeInsert event handler? Or did I misunderstand, and the
AfterInsert numbers are for the next record?

HTH,
Dan


Quote:

>Hi,

>Using D4 C/S P3, Paradox Tables, BDE 5.01.

>I'm having a problem with records randomly appearing in a table with
>no Job Number or Index Number (the Job Numer & Index Number are
>assigned to the record in the AfterInsert Method.

>When the user clicks the "New Record" button, it seems that in some
>cases the AfterInsert Method is not being executed. This doesn't
>happen often, but when it happens, the users cannot create any new
>records because they get a Key Violation Error.

>I haven't been able to track it down as yet and was wondering if
>anyone else has seen the same problem.

>Any help/advise would be great.

>Many Thanks

>Robbie...

--
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]


Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with AfterInsert Method, help needed...
Hi Dan,

The AfterInsert numbers are for the new record. As I understand, When
the BeforeInsert method is called, the new record has not been created
yet, or am I incorrect here....

Robbie...

Quote:

>After insert may be too late to add key fields. Can you put them in
>the BeforeInsert event handler? Or did I misunderstand, and the
>AfterInsert numbers are for the next record?

>HTH,
>Dan



>>Hi,

>>Using D4 C/S P3, Paradox Tables, BDE 5.01.

>>I'm having a problem with records randomly appearing in a table with
>>no Job Number or Index Number (the Job Numer & Index Number are
>>assigned to the record in the AfterInsert Method.

>>When the user clicks the "New Record" button, it seems that in some
>>cases the AfterInsert Method is not being executed. This doesn't
>>happen often, but when it happens, the users cannot create any new
>>records because they get a Key Violation Error.

>>I haven't been able to track it down as yet and was wondering if
>>anyone else has seen the same problem.

>>Any help/advise would be great.

>>Many Thanks

>>Robbie...



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with AfterInsert Method, help needed...

Quote:

>Hi Dan,

>The AfterInsert numbers are for the new record. As I understand, When
>the BeforeInsert method is called, the new record has not been created
>yet, or am I incorrect here....

I think you are right. Using the before insert event, you would add
the field data to the record that is going to be inserted at that
time. The whole record would then be written to the physical table,
complete with the data you just added in the event handler.

Dan
--
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]



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with AfterInsert Method, help needed...
The OnNewRecord event is the correct place to do what you're doing.

Also, any possibility that the record is getting added other than where you
think it is?

Paul / ColumbuSoft
www.columbusoft.com


Quote:
> Hi,

> Using D4 C/S P3, Paradox Tables, BDE 5.01.

> I'm having a problem with records randomly appearing in a table with
> no Job Number or Index Number (the Job Numer & Index Number are
> assigned to the record in the AfterInsert Method.

> When the user clicks the "New Record" button, it seems that in some
> cases the AfterInsert Method is not being executed. This doesn't
> happen often, but when it happens, the users cannot create any new
> records because they get a Key Violation Error.

> I haven't been able to track it down as yet and was wondering if
> anyone else has seen the same problem.

> Any help/advise would be great.

> Many Thanks

> Robbie...



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem with AfterInsert Method, help needed...

Quote:

>Hi,

>Using D4 C/S P3, Paradox Tables, BDE 5.01.

>I'm having a problem with records randomly appearing in a table with
>no Job Number or Index Number (the Job Numer & Index Number are
>assigned to the record in the AfterInsert Method.

>When the user clicks the "New Record" button, it seems that in some
>cases the AfterInsert Method is not being executed. This doesn't
>happen often, but when it happens, the users cannot create any new
>records because they get a Key Violation Error.

You should use the OnNewRecord event to put your IndexNumber in the
record.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Transaction Methods in Interbase using Delphi 3.0 -Problems in commit-rollback methods

2. Need help: got error trying to override a virtual method

3. Need help: got error trying to override a virtual method

4. Need help with virtual method in digital simulation

5. I need help with EmptyTable Method!

6. Help! Fast Method for combos needed

7. - TOutlineNode GetNextChild method - Help Needed

8. Need help with "addParam" method

9. Problem with Insert Method, Please Help...

10. (Q) TQuery Event AfterInsert never fired

11. property write method's problem....

12. Problem with MyDataset.Locate Method, D3

 

 
Powered by phpBB® Forum Software