out boolean OUT_Active; {default form to 'UPR_Employee_MNT';} {default window to 'UPR_Employee_MNT';} { Used for AutoGen Number } local string l_prefix; local integer l_length; local long l_number; OUT_Active = false; l_prefix = "EMP"; { Alpha Prefix to AutoGen Number } l_length = 6; { Length of Numeric part of Number } l_number = 1; { First Number in AutoGen Sequence } { Calculate Next Number } range clear table UPR_MSTR; clear table UPR_MSTR; 'Employee ID' of table UPR_MSTR = l_prefix+pad(str(0), LEADING, str(0), l_length); range start table UPR_MSTR; fill table UPR_MSTR; 'Employee ID' of table UPR_MSTR = l_prefix+pad(str(10^l_length-1), LEADING, str(0), l_length); range end table UPR_MSTR; get last table UPR_MSTR; if err() = OKAY then l_number = value('Employee ID' of table UPR_MSTR) + 1; end if. range clear table UPR_MSTR; { Insert Next Number } 'Employee ID' of window 'UPR_Employee_MNT' of form 'UPR_Employee_MNT' = l_prefix+pad(str(l_number), LEADING, str(0), l_length); focus 'Employee ID' of window 'UPR_Employee_MNT' of form 'UPR_Employee_MNT'; force change 'Employee ID' of window 'UPR_Employee_MNT' of form 'UPR_Employee_MNT';