How to generate ID

JAM

Member
Joined
Mar 9, 2003
Messages
24
Im using Access db, and VB.NEt. My case is to generate 1000 student IDs, lets say from 1 to 1000. What is the best way to do that? and How?
 
Dear Robby
I think you are talking about Auto Number in Access. This is good but not enough. Im trying to Insert 1000 id numbers at once. Currently, Im thinking about making a loop with an insert statement. I will let you know what happens.
 
If you Insert 1000 IDs, that means that there will be 1000 rows with no data in any of the columns except for the ID field.
 
well ,

i dont know exactly why you need 1000 rows with the id fierlds
filled but data absent. i think you are using the id firled as a primary key or not the at least unique as there is no point having 2 students with the same id.

if you have problem tracking what is the id of the last inserted student than you can let access manage it by using autoincrement
as robby pointed out.

Else you can have another table in the same database that has one row only and it stores the last inserted number. Every time you insert a record you incrementy this number before the actual insertion.

in this way even if the number is updated but entry fails then too you will have unique ids.
although there is a chance that u may some nos in between
 
This is what happened. I was able to insert 1000 id by using a loop. But Im considering what Robby and hemenkap seriously. So, Im no gonna use this loop.
Thank you all.
 
Back
Top