If what you are asking is how to add an auto increment key field to a form created by the form wizard, this is what I have done before. Add the following to the cmdAdd.Click() method (changing the table, field, and text box names of course):
* cmdAdd.Click()
lcOldDeleted = SET("DELETED"
SET DELETED OFF
* Must do this before the DODEFAULT(); it must move the record pointer.
CALCULATE MAX(requestor.nrequestor) TO lnmaxid
SET DELETED &lcOldDeleted
DODEFAULT() && Runs parent class code.
* Only set if value is 0. It was getting incremented twice.
IF THISFORM.txtnRequestor.Value = 0
THISFORM.txtnRequestor.Value = lnmaxid + 1
ENDIF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.