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:
VB Code:
  1. Dim Db As Database
  2. Dim rs As Recordset
  3. Dim SQL, SQL1 As String
  4. Set Db = CurrentDb
  5. SQL = "SELECT * From Table1"
  6. Set rs = Db.OpenRecordset(SQL)
  7.  
  8. With rs
  9.  
  10.         .MoveLast
  11.         .MoveFirst
  12.  
  13. Do While Not .EOF
  14.  
  15.              SQL1 = "UPDATE Table1 SET Table1.[IDT]=" & "'" & .AbsolutePosition + 1 & "'"
  16.              Db.Execute SQL1
  17.            
  18. .MoveNext
  19.         Loop
  20.  
  21.         .Close
  22.    
  23. End With
  24.  
  25.  
  26. Set Db = Nothing
  27. Set rs = Nothing
I guess I missed that I should have any criteria somewhere, but I dont know how I should do.