use below code in the create method of the form in data source level.
select maxOf(SequenceNumber) from dNPhaseLoc where dNPhaseLoc.DNModularID == DNModule.DNModularID;
DNPhase.SequenceNumber = dNPhaseLoc.SequenceNumber +1;
DNPhase.SequenceNumber = 1;
//Just add SequenceNumber as interger field for your table with reference to header datasoure record you need to use where clause.
Thus line no will be created.