Is Barcode tied to SequenceNumber?
If yes, and it is also stored in the table, then you will need to modify Arnel's suggestion to handle amending that field too.
I'm still not sure why you have to store the SequenceNumber - does it make a difference if Sriracha Chili Sauce comes after Sriracha...
Do you have code elsewhere that can change or re-order your sequence numbers?
The only way that your original code can give a sequence number of 0 would be if there is a SequenceNumber of -1 in your table.
Also, rather than looping the RecordsetClone, it might be easier/quicker to use DMax()...
Additionally, pay consideration to whether you really want to store the sequence number.
If an item is removed (eg mistake) then you will have to go and re-order the numbering of all the other items or you will have gaps.
Does the order sequence have any special meaning? If not, you can use a...
You can get it from the parent form then, but easier to add a control using the invoice FK on to the subform. It should populate automatically from the linked master/child fields
Is the ID field of tblLineDetails really a text datatype?
Generally, you would need to add to your criteria to find how many records came before the current one. You will also need to include the InvoiceID in your filter.
So, it may look like:
Dim strCritieria As String
strCriteria =...
Did you do a S.M.A.R.T test on your SSD?
My guess is that the 'Approaching End of Lifetime' is more a synthetic value assigned by Crucial tied to warranty coverage period, and that your disk is actually fine.
I have an SSD that is almost 5 years old but the S.M.A.R.T test doesn't show any...
Which treeview are you using?
Does Node.Root return the root node directly?
If so even simpler (almost tot the point of not needing a function at all!)
Private Function FindRoot(ByVal nodX As Node) As Node
Set FindRoot = nodX.Root
End Function
The root node won't have a .Parent property, so you get the Error 91.
You can handle it in your error handler and Resume Next for that err.Number.
But surely you know the root node using the expression to limit your While clause (nodX.Root.Index)
Why not bypass the whole While loop:
Private...