I have a form(Table1) with a subfrm(Table2)
Link by ID in each table
The main form generates the Purchase Order number - ID ( autonumber)
And Suppliers Name etc.
The sub form( tabular frm) contains LineNo, Qty, description and price. (LineNo is a number field)
I want the line number to start at 1 and increment by 1 for each item ordered
I have placed this in the before update of the ItemNo field
Me("ItemNo") = Nz(DMax("ItemNo","Table2"),0)+1
This works fine except the next time I create another Purchase Order
The ItemNo starts with the next number from the last Order instead of starting from 1 again.
Where am I going wrong
Thanks in Advance
Link by ID in each table
The main form generates the Purchase Order number - ID ( autonumber)
And Suppliers Name etc.
The sub form( tabular frm) contains LineNo, Qty, description and price. (LineNo is a number field)
I want the line number to start at 1 and increment by 1 for each item ordered
I have placed this in the before update of the ItemNo field
Me("ItemNo") = Nz(DMax("ItemNo","Table2"),0)+1
This works fine except the next time I create another Purchase Order
The ItemNo starts with the next number from the last Order instead of starting from 1 again.
Where am I going wrong
Thanks in Advance