There are 2 columns in 1 database for Id and name but the serial number is random.


I want to update those serial number in serial order, how to?

Like

id Name
------------
1 Shouvik
5 Joe
6 Mathew
3 John
4 James
2 Jack


I want to update it like

id Name
------------
1 Shouvik
2 Joe
3 Mathew
4 John
5 James
6 Jack

if i code it like

for x=1 to 4
conndb.execute "update tblcontest set id=" & x 
rs2.movenext
next

This way its updating all the colum with the number 4 only, any ideas?

Actually you are updating all records each time you loop in the code.

First you set all records to 1 then loop and set all records to 2 and so on….

The question would be is what does rs2 recordset contain
and is serial number the ID field?

Yes the serial number is the ID field

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.