Hi there,
Is there a way to add a consecutive no to a ID field in table?
I have a database contains a table named tblemployees. I have this link to a form which i use this form for editing and deleting records.
When record(s) was deleted in PK field shows missing numbers eg. 123...6...9.. i do not like database showing missing numbers.
What i prefer is to set an autonumber field and apply this code:
If ID=0 or Isnull(ID) then
ID= Dmax("[ID]", "tblemployees")+1
so that everytime when record was deleted it still creates a consecutive no from the last number.
With above code works fine from form button. Since i use append query for adding new info into tblemployees.
Is there any workaround this please?
Here is my SQL code:
INSERT INTO tblemployees ( ID, Firstname, Familyname )
SELECT tempwholesales.ID, tempwholesales.Firstname, tempwholesales.Familyname
FROM tempemployees;
Any help would appriciate
Is there a way to add a consecutive no to a ID field in table?
I have a database contains a table named tblemployees. I have this link to a form which i use this form for editing and deleting records.
When record(s) was deleted in PK field shows missing numbers eg. 123...6...9.. i do not like database showing missing numbers.
What i prefer is to set an autonumber field and apply this code:
If ID=0 or Isnull(ID) then
ID= Dmax("[ID]", "tblemployees")+1
so that everytime when record was deleted it still creates a consecutive no from the last number.
With above code works fine from form button. Since i use append query for adding new info into tblemployees.
Is there any workaround this please?
Here is my SQL code:
INSERT INTO tblemployees ( ID, Firstname, Familyname )
SELECT tempwholesales.ID, tempwholesales.Firstname, tempwholesales.Familyname
FROM tempemployees;
Any help would appriciate