I have a si,ilar situation where I need to generate lot numbers without any gaps. I solved the problem by putting this code in the PreSaveHook().
CALCULATE(MAX(nLotNumber)) to nLastLotNumber
nNextLotNumber = nLastLotNumber + 1
I indexed the table on the LotNumber field for efficiency and I haven't had any speed complaints.
HTH,
BobK
>Hi,
>I want to generate auto number for document such as invoice, PO and etc. Any function built in in MM for this purposes? I tried newid() but it will increase the value even the record is not saved. I don't want to have "hole" between theese number. Any ideas?
>
>Thank you
Bob Kocher
www.swfox.netStart making your plans now to attend Southwest Fox 2006