Expand|Select|Wrap|Line Numbers
- Set db = CurrentDb()
- Set rst = db.OpenRecordset("SELECT * FROM preordlin")
- Do
- rst.Edit
- rst!StkID = DLookup("[StkID]", "stkmas", "[StkShortDesc] ='" & rst!StkShortDesc & "'")
- rst!Price = DLookup("[SalePrice1]", "primas", "[StkID] =" & rst!StkID)
- rst!Cost = DLookup("[CostPrice1]", "primas", "[StkID] =" & rst!StkID)
- rst!ItemNo = [ItemNo] + 1
- rst.update
- rst.MoveNext
- Loop Until rst.EOF
- rst.Close
- Me.Requery
- Set rst = Nothing
I know i could use an autonumber but i require a sequence number filler code instead as the number have to reset themselves each time an order is being placed.
Is there a way i can tell the code to look at the previous row (ItemNo) and then + 1 to it? I have tried but unfortunately i have failed each time.
Any help would be much appreciated!