Hello,
I am new to Access and an trying to create a macro where in which an new incremental id is assigned to new records that are being added to the table. Here is my table
DGID Element_Name Element_Desc
----- ------------- -------------
DG001 abcd1 abcs1
DG002 abdds2 abds2
.
.
.
NULL acbds.. abcd...
As show above when new records are added to the table they would not have a DGID assigned. I need to write a query where the max DGID is taken and assigned to the new records. When there are multiple new records the macro should iterate by incremental assignment of the DGID
To do so I have created a reference table pre populated with DGID till 3500. and also have written a query to update this reference table which has a second column called Element_Present if there is a matching record found in the main table
Query as below.
UPDATE tbl_DGID_Reference INNER JOIN tbl_Repository ON tbl_DGID_Reference.Data_Governance_ID = tbl_Repository.Data_Governance_ID SET tbl_DGID_Reference.Element_Present = IIf([tbl_DGID_Reference]![Data_Governance_ID]=[tbl_Repository]![Data_Governance_ID],"Yes","No");
If a field is present then Element_Present will have "Yes" populated, otherwise its "No"
Now, I need to write a macros to iterate the records by getting the Min(DGID) where Element_Present = "No" and iterate the above query every time a new DGID is populated.
Please let me know how to write a macro to acheive this.
Thanks!