View Single Post
 
Old 08-04-2021, 07:53 AM
gjergj_06 gjergj_06 is offline Windows 10 Office 2016
Novice
 
Join Date: Aug 2021
Posts: 2
gjergj_06 is on a distinguished road
Default

Quote:
Originally Posted by ArviLaanemets View Post
It isn't reasonable to use formulas for generating an unique ID for entry, because you cant create such ID without it being dependent on record position. I.e. whenever user sorts the table, all ID's are changed - and your ID will be meaningless!

Probably is possible to create some VBA procedure which generates such ID whenever a new entry row is created, but it will be prone to faulty results (it's practically impossible to control in which order are cells filled when a new entry is filled, and which row in your table will have the new entry).

I myself prefer the approach, where:
On hidden sheet, the next ID is calculated - preferably a dynamic one (e.g. when in your table active row has ID, the next ID is equal to it, when ID field for active row in your table is empty, ID with MAX value is read from tables ID column, and 1 is added);
The cell where next ID is calculated is defined as Name;
In your table, you define Data Validation list for column where entry ID's are entered, with this defined Name as source. Now when the row has ID, the user can select only existing ID, but when ID field is empty, the user can select only predefined new ID. And for all other formulas, which use data from your table, you can ignore rows where ID field is empty!

What If i use office 365 since my file will mostly be in sharepoint? Is that easier or it does not have any effect?
Reply With Quote