replace DocNumber with "2004-" + padl(SerialNumber("Sequence_1"), 6, "0")But first, get the function SerialNumber to work.
>local lnSelect >lnSelect = select() >if used("serialnumber") > select serialnumber >else > select 0 > use serialnumber >endif >*set order to "sequence" >seek padr(tnSequence, len(sequence)) >if not found() > append blank > replace sequence with tnSequence, nextnum with 1 >* replace thisform.text1.value with tnSequence, nextnum with 1 >endif >local lnReturnValue >if lock() > lnReturnValue = nextnum > replace nextnum with nextnum + 1 >else > lnReturnValue = -1 >endif >select (lnSelect) >unlock >return lnReturnValue >>