Set a start value in an autoincrementing field

The truth is that it is simple (at least in Access 2007), a way that I had not tried yet. Just doing an insert query on the table with the id value I want is done.

Example: TableEmpresas with 2 fields: idEmpresa, idNombre. Being idEmpresa an autonumerical, and even if you have already entered companies, you can insert the following with the identifier number you want with an SQL query. From there the counter will continue by the number you have entered:

INSERT INTO CompanyTable VALUES (5500, “Company1”)

So, when you continue entering data from a form or from the data sheet view, the following companies will continue from that id: 5501, 5502, 5503…

As you can imagine, if you want to set that starting value, all you have to do is insert a first record into the table with an identifier equal to the number you want your autoincrementing field to start with.

I had read a Microsoft help article and did it in a super elaborate way. But this way is totally simple.

All the best!

See also  Generics in TypeScript
Loading Facebook Comments ...
Loading Disqus Comments ...