I wanna create my own AutoNumber Field with AbsolutePosition function. So it always is in numeric order and no number been skipped.
I do like this, but it doesen't work:
I guess I missed that I should have any criteria somewhere, but I dont know how I should do.VB Code:
Dim Db As Database Dim rs As Recordset Dim SQL, SQL1 As String Set Db = CurrentDb SQL = "SELECT * From Table1" Set rs = Db.OpenRecordset(SQL) With rs .MoveLast .MoveFirst Do While Not .EOF SQL1 = "UPDATE Table1 SET Table1.[IDT]=" & "'" & .AbsolutePosition + 1 & "'" Db.Execute SQL1 .MoveNext Loop .Close End With Set Db = Nothing Set rs = Nothing




Reply With Quote