dhanesh
Apr 28 2007, 11:50 AM
I have a small registration software i made. It basically will just let the person sitting on the software type in details like Name, location, college etc and when the "Enter" is hit, all that info typed on screen goes into an access DB and all the fields get cleared to type in the next record. Here my Record ID property is set as autonumbered in access. While i run and add records into the software everything works fine say like this : ID Name Age 1 aaaaa 19 2 bbbbb 21 3 ccccc 20 4 ddddd 18 5 eeeee 22 Now i want to run it in actual live mode and i delete the records 1 - 5 from the access DB, the next time i add a new record through the software, it starts from 6. I also tried deleting 3 & 4 from the list, but instead of rearranging or autorefreshing the numbers it shows like this : ID Name Age 1 aaaaa 19 2 bbbbb 21 5 eeeee 22 Is there a way i can fix this small glitch ? i.e if i delete any record from between, then the auto number should refresh all the numbers to one after another like this : ID Name Age 1 aaaaa 19 2 bbbbb 21 3 eeeee 22 Regards Dhanesh.
Reply
faulty.lee
Apr 28 2007, 02:07 PM
QUOTE(dhanesh @ Apr 28 2007, 07:50 PM)  Now i want to run it in actual live mode and i delete the records 1 - 5 from the access DB, the next time i add a new record through the software, it starts from 6. I also tried deleting 3 & 4 from the list, but instead of rearranging or autorefreshing the numbers it shows like this :
ID Name Age 1 aaaaa 19 2 bbbbb 21 5 eeeee 22
Is there a way i can fix this small glitch ? i.e if i delete any record from between, then the auto number should refresh all the numbers to one after another like this :
ID Name Age 1 aaaaa 19 2 bbbbb 21 3 eeeee 22 That's is actually not a glitch, it's how auto increment works and it's an important feature to ensure data integrity. Say for example, you have another table to keep track of the user's history, maybe last active/visit. It should look like this: YOUR ORIGINAL TABLE: ID Name Age 1 aaaaa 19 2 bbbbb 21 3 ccccc 20 4 ddddd 18 5 eeeee 22 HISTORY TABLE: HistoryID UserID LastVisit 1 1 12/04/2007 2 1 13/04/2007 3 3 15/04/2007 4 2 20/04/2007 5 5 21/04/2007 UserID in history table is referring to your user table. By referring just the ID, you can create a lot of relating table to keep things, and you only need to update 1 table if the user happen to change it's age, since all referring table point to the same ID. That's how relational database works. Now say you wanted it to works the way it you proposed after deleting a few records: ID Name Age 1 aaaaa 19 2 bbbbb 21 3 eeeee 22 At this time, in history table, entry 3 which is suppose to refer to "ccccc", is now referring to "eeeee", which is wrong. That's why ID has to remain unique and permanent, representable for each record to ensure that these kind of problem does not happen. Imagine, say your phone bill account number, which is also auto increment and unique, happen to change when the guy before you decide to disconnect his phone, and the phone company deleted his record. So, in this case, you are assigning a unique ID to your users, so it has to remain permanent per user. Don't try to fix it, but instead try to exploit it's usefulness.
Reply
Quatrux
Apr 28 2007, 03:28 PM
I wanted to say the same thing about this issue, even though when I started playing with databases, I also thought that I want the numbers to generate from 1 2 3 and after deletion of 2 to include 2 later, that it would look better.. but with time I understood that it is pointless to look at your auto increment ID and I recommend to keep your eyes away form it and ignore the number, who cares about the number, usually the number, the unique id isn't supposed to be shown, the main thing in the database is the data, but an AutoNumber ID is really good to find and select, update etc. your data, so to conclude, don't care about it, this is the way it needs to work.
Reply
dhanesh
Apr 28 2007, 05:54 PM
EDIT: In the Access DB the Age field is specified as number and not text. When i try to add the fields from the frontend it acts a little weird. I cant explain how weird cause when a piece of code to add a row is put in, then it shows me a conversion error. Duno how to explain this but if you are familiar with such an error please tell me how to correct it. I use VB >NET 2005. Thanks Thanks for getting that off my brains guys  , thought it was something from my side. Newayz, the main intension of all this fuss was that the database after getting filled with data would be saved as an excel file for further use. So my concern was not redundancy errors here, tho i understand what this could do in a major application. Regards Dhanesh.
Reply
faulty.lee
Apr 28 2007, 06:14 PM
If that's what you want, you've 2 option. 1. Create another column named "No", integer. Whenever you update the database, update the column also with incrementing numbering. Or only update the numbering before you export to excel 2. If you're generating the excel from your coding, then manually insert a column whenever you generate the excel file, that column should be the numbering.
Reply
Pete
May 2 2007, 11:09 AM
QUOTE(faulty.lee @ Apr 28 2007, 03:07 PM)  That's is actually not a glitch, it's how auto increment works and it's an important feature to ensure data integrity. Say for example, you have another table to keep track of the user's history, maybe last active/visit. It should look like this: YOUR ORIGINAL TABLE: ID Name Age 1 aaaaa 19 2 bbbbb 21 3 ccccc 20 4 ddddd 18 5 eeeee 22
HISTORY TABLE: HistoryID UserID LastVisit 1 1 12/04/2007 2 1 13/04/2007 3 3 15/04/2007 4 2 20/04/2007 5 5 21/04/2007
UserID in history table is referring to your user table. By referring just the ID, you can create a lot of relating table to keep things, and you only need to update 1 table if the user happen to change it's age, since all referring table point to the same ID. That's how relational database works.
Now say you wanted it to works the way it you proposed after deleting a few records: ID Name Age 1 aaaaa 19 2 bbbbb 21 3 eeeee 22
At this time, in history table, entry 3 which is suppose to refer to "ccccc", is now referring to "eeeee", which is wrong. That's why ID has to remain unique and permanent, representable for each record to ensure that these kind of problem does not happen.
Imagine, say your phone bill account number, which is also auto increment and unique, happen to change when the guy before you decide to disconnect his phone, and the phone company deleted his record.
So, in this case, you are assigning a unique ID to your users, so it has to remain permanent per user. Don't try to fix it, but instead try to exploit it's usefulness. Hi, i have a similar issue but the other way round. I have an MDB database with a primary key of an auto number and i'm connecting through VB.NET 2005 using drag and drop datasets. In MS Access if i delete a table entry then add another record the autonumber icrements as though the previous record was not deleted (which is good) but in VB.NET when i go to add a new record it will assume the number of that previously deleted within MS Access but i would like it to continue the incrementation in sync with Access as i want to move record from the active table into a completed table but maintain integrity as the auto number is the job number. Any help would be appreciated.
Reply
faulty.lee
May 2 2007, 12:23 PM
QUOTE(Pete @ May 2 2007, 07:09 PM)  Hi, i have a similar issue but the other way round. I have an MDB database with a primary key of an auto number and i'm connecting through VB.NET 2005 using drag and drop datasets. In MS Access if i delete a table entry then add another record the autonumber icrements as though the previous record was not deleted (which is good) but in VB.NET when i go to add a new record it will assume the number of that previously deleted within MS Access but i would like it to continue the incrementation in sync with Access as i want to move record from the active table into a completed table but maintain integrity as the auto number is the job number.
Any help would be appreciated. Don't quite get you. Can you lay out a bit of example to make it clearer?
Reply
Recent Queries:--
how to show auto number in vb.net - 64.76 hr back. (1)
-
vb net and access 2007 - 66.36 hr back. (1)
-
selecting auto number field in access database - 71.41 hr back. (1)
-
selecting auto number field in access - 71.43 hr back. (1)
-
how to generate an auto number in excel 2007. - 93.66 hr back. (1)
-
auto number in visual basic - 127.90 hr back. (1)
-
database autonumber redundancy - 140.54 hr back. (1)
-
autonumber insert in ms-access - vb.net - 152.25 hr back. (1)
-
how to find the next autonumber in vb.net - 163.97 hr back. (1)
-
.net access add record - 232.38 hr back. (1)
-
access vb.net add record - 233.61 hr back. (1)
-
vb access increment number - 249.07 hr back. (1)
-
excel auto increment number - 281.49 hr back. (1)
-
vb find last record access - 332.56 hr back. (1)
Similar Topics
Keywords : auto, number, access, db, and, vb, net
- How To Access Child Node / Collection Items In A Class
Ways of accessing the child nodes of a Tree Node (6)
VB.NET & MS Access Issue
(7) Alright, I haven't had much experience with vb.net or ms access as it is, let alone using them
together, so I need some advice on the best way to do this. I need to create a program that
basically is a form to fill out with information, and upon filling it out it can be saved. Saving
consists of making a row in a ms access database and placing each field as a column entry within
this new row. Then I need to be able to retrieve this information from the DB and fill out the form
as it was originally if the user chooses to load. This is all fine and wasn't hard to....
VB.NET / MS Access Question
(6) Jeez .. i can see people already starting to take up sticks and stones to beat me up .. well .. i
know m annoying .. and this always happens when my questions are related to programming
/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Newayz ..
to the point .. I have an MS Access DB .. I need a VB Code to retrieve the value from a field in
the table. Let me just put it in a better way. I have a table that has a column: Sno. .. under
sno. i have numbers like 1,2,3,4,5,6,7,8 .... now i created a form where i could view the rec....
VB6-MS Access Question
help please (9) hi guys, I am developing an application in Visual Basic 6.0 and using MS Access as my backend. What
i want is that my database should not open when someone doublec clicks on the .mdb file. But my
application should be able to access it. What can be a possible solution to this problem? Please
help. Thanx in advance.....
VB: Howto Auto-select Last Item In Listbox
(5) Hi, I'm just writing a small program with a friend that is kind of pointless at the moment
/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> but there was one issue
that we haven't been able to work out with a listbox and we aren't too sure if its even
possible to do it. /unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' /> My
question is, is it possible to make a listbox automatically scroll to the bottom of the list when a
new item is added? if so can anyone please let me know? Thank you all in advance for ....
Looking for auto, number, access, db, and, vb, net
|
*SIMILAR VIDEOS*
Searching Video's for auto, number, access, db, and, vb, net
|
advertisement
|
|