Hello everybody,
I have posted before but my after talking to my manager we have come up with a format with a unique id that he wants me to auto generate. I have a form with three fields, which are
1.model (name is "model_type")
2.date
3.Id(primary key)
The model is a combo box with options the user chooses. Then I have the date which is automatically put in with the function "Date()" in default value. Then I have an Id field with an auto generate button I have created right next to the field. First question is, should the id field be auto number or text data type? Second question is how do I code the button to first of all to link to the field so when I click on it, it will auto generate the id( the id field name is "uniqueid"), and third, how do I code the button to auto generate the unique id. The format of the id my boss has given me is first the model, depending on what the user clicks on from the combo box, second is the current year, it can be 2016 or just 16, and then 001 or 0001, either is fine. Then after that, the last part of the id 001 will increment to 002 or 0002 to 003 or 0003 and so on after clicking the button. So for example the format of the id that can be auto generated could be "S72-16-001" or "S89-2016-0001", the first part depending on what model the user picked l and the second id generated in the database can be "S72-16-002". All help will be appreciated. I am a beginner in access and have very little knowledge on vba.
Thanks!