Hi Y'all,
We generate several invoices for products weekly. In my filtered form. In my code below I'm trying to get my invoice field to generate consecutive invoice numbers based on the first date
in the first record "BY DATE". In other words in the InvoiceNumber field in the first record we type 20191501 then the next record would return 20191502, etc. on the date of 2/15/19.
Then on the next date of 2/16/19, we would start over with 20191601, 20191602 etc. Everything in the code works until we change to the next date and can't see to get it correct? Very new to all of this
so some simple help would be appreciated.
Thanks,
Code:
Dim ID As LongID = DMax("ProductID", "ProductT")
DoCmd.GoToRecord , , acNewRec
ProductName = DLookup("ProductName", "ProductT", "ProductID=" & ID)
SalePrice = DLookup("SalePrice", "ProductT", "ProductID=" & ID)
DateEntered = DLookup("DateEntered", "ProductT", "ProductID=" & ID)
InvoiceNumber.SetFocus
If Me.NewRecord = True Then
Me.Slot = Nz(DMax("InvoiceNumber", "ProductT"), 1) + 1
End If