Fuga
Registered User.
- Local time
- Today, 09:39
- Joined
- Feb 28, 2002
- Messages
- 566
Problem with recordset.**resolved**
I´m trying to have the db going through the records in a table and, depending on values, change the values of records in another table.
Of course, it´s not working.
[vb]
Sub trend()
Dim dt As String
Dim rs2 As DAO.Recordset
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tbl1")
rs.MoveFirst
Do While Not rs.EOF
dt = rs.Fields(0)
Set rs2 = CurrentDb.OpenRecordset("select * from tbl2 where date > " & dt & " order by date asc")
If rs.Fields(1) = -1 Then
rs2.Edit
rs2![upptrend] = -1
rs2.Update
Else
rs2.Edit
rs2![upptrend] = 0
rs2.Update
End If
rs2.Delete
rs.MoveNext
Loop
End Sub
[/vb]
when I check tbl2, something has happened with the first record (which should not be selected actually), but that´s it.
Fuga.
I´m trying to have the db going through the records in a table and, depending on values, change the values of records in another table.
Of course, it´s not working.
[vb]
Sub trend()
Dim dt As String
Dim rs2 As DAO.Recordset
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tbl1")
rs.MoveFirst
Do While Not rs.EOF
dt = rs.Fields(0)
Set rs2 = CurrentDb.OpenRecordset("select * from tbl2 where date > " & dt & " order by date asc")
If rs.Fields(1) = -1 Then
rs2.Edit
rs2![upptrend] = -1
rs2.Update
Else
rs2.Edit
rs2![upptrend] = 0
rs2.Update
End If
rs2.Delete
rs.MoveNext
Loop
End Sub
[/vb]
when I check tbl2, something has happened with the first record (which should not be selected actually), but that´s it.
Fuga.
Last edited: