JAM Posted March 14, 2003 Posted March 14, 2003 I'm 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? Quote
Moderators Robby Posted March 15, 2003 Moderators Posted March 15, 2003 You can let Access AutoIncrement the ID for you. Quote Visit...Bassic Software
JAM Posted March 15, 2003 Author Posted March 15, 2003 Dear Robby I think you are talking about Auto Number in Access. This is good but not enough. I'm trying to Insert 1000 id numbers at once. Currently, I'm thinking about making a loop with an insert statement. I will let you know what happens. Quote
Moderators Robby Posted March 15, 2003 Moderators Posted March 15, 2003 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. Quote Visit...Bassic Software
hemenkap Posted March 17, 2003 Posted March 17, 2003 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 Quote
JAM Posted March 17, 2003 Author Posted March 17, 2003 This is what happened. I was able to insert 1000 id by using a loop. But I'm considering what Robby and hemenkap seriously. So, I'm no gonna use this loop. Thank you all. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.