stillwillyboy
Technical User
I have looked at so many DMax, SQL and recordset articles that my brain is oozing from my ears. It seems that for every programmer, there is a different method to achieve the same objective. The following example returns the highest value from the invoicenumber field. The domain is the ar--InvoiceNumberList table.
Sub IncrementingInvoiceNumbers()
Dim curY As Integer
curY = DMax("[invoicenumber]", "[ar--InvoiceNumberList]") + 1
MsgBox curY
End Sub
The above works. It adds "1" to the current highest number in the table "ar--InvoiceNumberList". It shows in the Msgbox the number "5" if the highest number in the table is "4". OK.
I want the new highest number, "5" in this case, to be added to the "ar--InvoiceNumberList" table. Then when I run it again, "6", then "7", you get the picture.
A simple line or two of code would be very greatly appreciated.
Sub IncrementingInvoiceNumbers()
Dim curY As Integer
curY = DMax("[invoicenumber]", "[ar--InvoiceNumberList]") + 1
MsgBox curY
End Sub
The above works. It adds "1" to the current highest number in the table "ar--InvoiceNumberList". It shows in the Msgbox the number "5" if the highest number in the table is "4". OK.
I want the new highest number, "5" in this case, to be added to the "ar--InvoiceNumberList" table. Then when I run it again, "6", then "7", you get the picture.
A simple line or two of code would be very greatly appreciated.