AX 2009 : how to solve the problem of the sequence number

why the error message always appears when i will make a new sequence number


Error message : "Cannot create a record in Number sequence (NumberSequenceTable). Number sequence code: 1702, 1702.

The record already exists. "


My program with X++ :

select forupdate NumberSequenceTable;

NumberSequenceTable.initValue();

NumberSequenceTable.NumberSequence= 1702;

NumberSequenceTable.Txt= 1702;

NumberSequenceTable.Lowest= 1;

NumberSequenceTable.Highest= 9999;

NumberSequenceTable.NextRec= 1;

NumberSequenceTable.Format= 1702+"####";

NumberSequenceTable.Continuous = NoYes::No;

NumberSequenceTable.CleanAtAccess= NoYes::No;

NumberSequenceTable.InUse= NoYes::No;

NumberSequenceTable.CleanInterval= 0;

NumberSequenceTable.CG_NumSeqModule= NumberSequenceModule::Inventory;

NumberSequenceTable.insert();

thank you and sorry to my english.

not sure about your intention.

you are not using any fields(in where clause) to find the record for update.

so it will find the first record( in the order of the index fields).

When you are selecting for an update why you are doing an insert?