Hi all,
I am having a problem with generating an "item no" for my product on my database.
The item number format is 000-00000-00, where the first 2 digits define the Category id, 3rd digit defines Sub-category id, the middle 5 digits are auto number as Project id, the last 2 digits are Licence id.
I have created 3 tables for the Category, Sub-Category and Licence.
CatList:
SubCatList:
1 |
SubCatA |
2 |
SubCatB |
3 |
SubCatC |
LicenceList:
On my Form I have combo list set for all Category, Sub-Category and Licence (in words). I need to generate item number when saving the record. I have only managed to show the item number in a textbox using query. But I don't know how to store the numbers into my main database. Please help!
Below is the code I used for the text box.
Code:
=DLookUp("[ItemNumber]","[ItemNumberQuery]","[ProjectID]=" & [Forms]![Records]![ProjectID])
And on my query, the item number is calculated:
Code:
ItemNumber: Format([CatList].[CatID],"00") & [SubCatID] & "-" & Format([ProjectID],"00000") & "-" & Format([LicenseID],"00")
What is the best way to calculate and store the item number on the Form?
Thank you in advance.
Best Regards,
Jo