I have a similar routine to the one Craig described in my VFP FAQ: "
How do I generate a new ID?"
Or search the index at:
http://www.feldstein.net/vfp_tips_tricks.aspNote that when Craig and I wrote those articles, VFP did not have an AutoInc field. In VFP9 and VFP8 you can simply set one PK field as AutoInc and you are set. If you prefer to keep a counter (or in older VFP versions), these routines work very well.