Board index » delphi » Autoincrement field and Access 97 with Delphi 5

Autoincrement field and Access 97 with Delphi 5

Hi,

I'm using Delphi 5.0 Pro (updatepack-1) and the native Access driver of BDE
5.11 to connect to my MS-Access 97 database.
I have defined an AutoIncrement field (sequential numbers) as primary key. I
can read and edit the table. But when I insert a new record, the
AutoIncrement field is not increased by 1 but by 2!! When I restart my
program and insert another record, the autoincrement field of the first
insertion is sometimes increased by 10 or more.... So after 24 records the
value of the autoincrement field is 307 instead of 24.
When I changed the access 97 database to a Paradox 7 database the code works
fine. Does somebody know how to solve this problem by using Access 97 and
the BDE? Please help me.

Thanks in advance

Arjan Niessen
 (The Netherlands)

 

Re:Autoincrement field and Access 97 with Delphi 5


Quote
"Arjan Niessen" <j.a.nies...@purac.com> wrote in message

news:980285668.9251.0.pluto.d4ee016e@news.demon.nl...

Quote
> Hi,

> I'm using Delphi 5.0 Pro (updatepack-1) and the native Access driver of
BDE
> 5.11 to connect to my MS-Access 97 database.
> I have defined an AutoIncrement field (sequential numbers) as primary key.
I
> can read and edit the table. But when I insert a new record, the
> AutoIncrement field is not increased by 1 but by 2!! When I restart my
> program and insert another record, the autoincrement field of the first
> insertion is sometimes increased by 10 or more.... So after 24 records the
> value of the autoincrement field is 307 instead of 24.
> When I changed the access 97 database to a Paradox 7 database the code
works
> fine. Does somebody know how to solve this problem by using Access 97 and
> the BDE? Please help me.

> Thanks in advance

> Arjan Niessen
>  (The Netherlands)

There is no solution!

  The BDE works on the way that in initiate autoincrement generator more
then once on insert of the record (the generator is triggered before insert,
not due the time of it - see TRIGGERS).

  This you can see, if you try to insert new record and cancel insertion
process. On next insertion, the value will be for the both inputs. In
Paradox, the things are different. If you try to insert new record and
cancel it, on next insertion, the value of autoincrement field will be
"previous +1", NOT shifted like "previous +2", or something. But, there is a
problem in Paradox tables. THAT autoincremental fields need reindexing, and
they are not stabile (like Access ones).

Dusko Vuksanovic
w...@gmx.net

Other Threads