1. Follow the link faq184-259
2. If you do not want to follow the suggestion in that link... then..
** This File opening can be done in Data Environment
USE myFile ORDER myPrimaryKey AGAIN IN 0 ALIAS myKeyCount
and then you can put the following codes in a suitable place where you want to add... say in the save button...
*************************
GO BOTTOM IN myKeyCount
LOCAL cMyKey, nMyKey
cMyKey = myKeyCount.myPrimaryKey
nMyKey = VAL(cMyKey) + 1
cMyKey = RIGHT("0000"+ALLTRIM(STR(nMyKey)),4)
***************************
SO THE VALUE IN cMyKey IS YOUR NEXT KEY. Hope you get the idea.
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com