RE: Secret to Auto Increment ID in VFP8

Author: Cindy Winegarden

Posted: 2003-02-07 at 13:15:00

You can also reset it to 0 if you've ZAPped the table.

Here's how GenDBC does it:

CREATE TABLE 'TEST1.DBF' NAME 'TEST1' (FIELD1 C(10) NOT NULL, ;

FIELD2 I NOT NULL, ;

FIELD3 M NOT NULL, ;

FIELD4 I NOT NULL AUTOINC NEXTVALUE 5 STEP 3)

Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP

cindy.winegarden@mvps.org=20

-----Original Message-----

From: profox-admin@leafe.com [mailto:profox-admin@leafe.com] On Behalf =

Of

Stephen Russell

Sent: Friday, February 07, 2003 9:46 AM

To: profox@leafe.com

Subject: Secret to Auto Increment ID in VFP8

I got this off the UT. Enjoy.

>Can anyone give me the skinny on how this works? (Behind-the-scenes =

stuff.)

>

>Thanks in Advance.

There is a tiny mouse cage. In the cage is a spinning wheel. There is =

also a

lepracan. When you add a record the lepracan temps the mouse with a =

piece of

magic cheese. This causes the mouse to run in the wheel, and VFP counts =

the

wheel rotations. The lepracaun just knows by magic when to give the =

mouse

the cheese... so, you get the next id.

Actually, I believe a few bytes unused in the .dbf header was stolen to

store the next id value. If you already have values, when you change the

type to auto-increment you can specify the 'next id' so it wont conflict

with your existing numbers.

Bob Archer

Stephen Russell

President

S.R. & Associates

Memphis TN

901.246-0159

[excessive quoting removed by server]

©2003 Cindy Winegarden