
"Object Required" for recordset
Hi,
I posted something like this earlier, but i've updated my code a bit. I'm
trying to move stuff from one recordset to another, but i get an "Object
Required" error at the line of the second If statment. What does that
mean, and how can i fix it? This is the code:
Sub make_table2()
Dim intClientID, intCount As Integer
Dim db, db2 As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Service with all brefs", dbOpenDynaset)
Set rst2 = db.OpenRecordset("Find duplicates for New service no
blanks", dbOpenDynaset)
rst2.MoveLast
rst2.MoveFirst
Do Until rst2.EOF
If intClientID <> rst2!clientid Then
rst.AddNew
rst("clientid") = rst2("clientid")
rst("bref1") = rst2("bref")
intClientID = rst2!clientid
Else
rst.Edit
If rst!bref2 Is Not Null Then <--------Error happens here
rst("bref2") = rst2("bref")
Else
If rst!bref3 Is Not Null Then
rst("bref3") = rst2("bref")
Else
rst("bref4") = rst2("bref")
End If
End If
End If
rst.update
rst.MoveLast
rst2.MoveNext
Loop
rst.close
End Sub
--
Posted via CNET Help.com
http://www.*-*-*.com/