Solution to solve Number Sequence Problem for the Error "A new number cannot be assigned because ******* has not been saved or deleted."

Hi,

I got a new solution to the Error “A new number cannot be assigned because ******* has not been saved or deleted.”

This error is thrown when creating more then 1 new record(Ctrl+N) to the grid of the form that has datasource with NumberSequence.

We have to save the datasource(Ctrl + S) or delete the record(Alt +F9) to overcome this.

The new solution is,

  1. create a new method in datasource, say moveNext() and paste the code.
public void moveNext()
{
    Collection_Detail _collection_Detail;               //table buffer for table
    select count(RecId) from _collection_Detail;        //checking to find total record in the DS
    if(this.getPosition() == _collection_Detail.RecId)
        this.setPosition(this.getPosition()-1);
    else
        this.setPosition(this.getPosition()+1);
}
  1. override the createRecord() or create() in case of AX 2009,
public void createRecord(str _formDataSourceName, boolean _append = false)
{
    Collection_Detail_ds.moveNext();                    //call to a method in the datasource
    super(_formDataSourceName, _append);
}

I think this may help u all.