Reputation: 1
I have a function in a module to get data from a third part software. And I have a sub fuction to get more data from the same third part software. Instead of editing the same row, the sub fuction only add a new row with the information retrieve from the other software. But I need the information in the row that already has in the table.
Its the code from the sub function.
Sub Entregue()
Dim base As Database
Dim Itens_Sislog As Recordset
Set base = CurrentDb()
Set Itens_Sislog = base.OpenRecordset("Itens_Sislog")
Dim i As Integer
Dim linha As Integer
If Copiar(1, 2, 8) = "SLCM0750" Then
Colar 13, 3, "X"
Teclar "@E"
End If
If Copiar(1, 2, 8) = "SLCM0751" Then
Itens_Sislog.Edit
Itens_Sislog("Entregue_em") = Copiar(14, 9, 11)
Itens_Sislog.Update
Teclar "@3"
Teclar "@3"
End If
End Sub
If I change this Itens_Sislog.Edit to this Itens_Sislog.addnew, it works and add new information. But I want to edit the row to add this new information into another column not to another row.
Edit: The function and sub work at the same time ( I don'to know if this information is important.) When I use the .addnew that is the result:
Anyone has a clue?
Upvotes: 0
Views: 50
Reputation: 55981
You are just opening the recordset, so any edit will be of the first record only.
Do first a search:
Itens_Sislog.FindFirst "SomeField = " & SomeValue & "" ' or for text:
Itens_Sislog.FindFirst "SomeField = '" & SomeValue & "'"
to find the record to edit.
For examples etc., the doc is alive:
Recordset.FindFirst method (DAO)
Upvotes: 0