Hi,
I have a small problem. I would like to create a delete routine in visualbasic 6.0 that takes an access database that has the primary key as 'ID' which is an autoindex integer that becomes disorganized as records are taken out of the list. I would like to take the index number, and press a button that makes all the indexes sequential again.
example:
original database:
ID Name Phone etc....
1 joe 21342134 ...
4 sally 12313 ...
7 bob 23423 ....
11 jimbob 1123 ...
After Conversion button pressed:
ID Name Phone etc....
1 joe 21342134 ...
2 sally 12313 ...
3 bob 23423 ....
4 jimbob 1123 ...
i originally defined a recordset named 'myRS' but when i tried to go through a loop and change each index number, i got an error. I have a listbox that has a copy of all of the entries in the database. I use it to delete an entry in the database every time there is a click event in the listbox, then it is supposed to reorganize the index numbers every time an entry is deleted. The code that i used was:
for i = 1 to mylistbox.listcount - 1
myRS.edit
myRS!ID = i
myRS.update
next i
Can anyone help me?
thanks
I have a small problem. I would like to create a delete routine in visualbasic 6.0 that takes an access database that has the primary key as 'ID' which is an autoindex integer that becomes disorganized as records are taken out of the list. I would like to take the index number, and press a button that makes all the indexes sequential again.
example:
original database:
ID Name Phone etc....
1 joe 21342134 ...
4 sally 12313 ...
7 bob 23423 ....
11 jimbob 1123 ...
After Conversion button pressed:
ID Name Phone etc....
1 joe 21342134 ...
2 sally 12313 ...
3 bob 23423 ....
4 jimbob 1123 ...
i originally defined a recordset named 'myRS' but when i tried to go through a loop and change each index number, i got an error. I have a listbox that has a copy of all of the entries in the database. I use it to delete an entry in the database every time there is a click event in the listbox, then it is supposed to reorganize the index numbers every time an entry is deleted. The code that i used was:
for i = 1 to mylistbox.listcount - 1
myRS.edit
myRS!ID = i
myRS.update
next i
Can anyone help me?
thanks