G
Guest
I finally foud out how DAO.recordset is working. Thanks to all the posted
items.
I am almost there, but the next error occurs:
Run-time error 3020: "Update or Cancelupdate without Addnew or Edit"
I want to go to record one, pick-up the value in field ID, go to the next
record and place this value in field ID.
And loop through the whole table.
I actually can see the value which has been picked-up, but Access cannot
update the table.
Here is the code:
Shell is the table/[ID] is the field
Private Sub Command0_Click()
Dim mydb As Database
Dim rst As DAO.Recordset
Dim waarde As String
Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset("SELECT Shell.[ID]FROM shell;")
rst.MoveFirst
Do Until rst.EOF = True
waarde = rst![ID]
rst.MoveNext
rst![ID] = waarde
rst.Update
rst.MoveNext
Loop
Set rst = Nothing
Set mydb = Nothing
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
Exit Sub
Resume Exit_Command0_Click
End Sub
items.
I am almost there, but the next error occurs:
Run-time error 3020: "Update or Cancelupdate without Addnew or Edit"
I want to go to record one, pick-up the value in field ID, go to the next
record and place this value in field ID.
And loop through the whole table.
I actually can see the value which has been picked-up, but Access cannot
update the table.
Here is the code:
Shell is the table/[ID] is the field
Private Sub Command0_Click()
Dim mydb As Database
Dim rst As DAO.Recordset
Dim waarde As String
Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset("SELECT Shell.[ID]FROM shell;")
rst.MoveFirst
Do Until rst.EOF = True
waarde = rst![ID]
rst.MoveNext
rst![ID] = waarde
rst.Update
rst.MoveNext
Loop
Set rst = Nothing
Set mydb = Nothing
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
Exit Sub
Resume Exit_Command0_Click
End Sub