im trying to open a recordset from a table based on a query statement. I have attached the code up to the point where I get a "Run-time error '424' : Object Required". Can anyone see the problem in the code?
Dim query As String
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Set rs1 = CurrentDb.OpenRecordset("EmployeeData")
Do Until rs1.EOF 'D0 runs the code below until it reaches the end of the recordset
'creates a new recordset w/ records from ResourceAllocation table
'where HRID(RA) = HRID(ED) and project lies within the month
query = "SELECT ResourceAllocation.* FROM ResourceAllocation WHERE (((ResourceAllocation.[HRID]) = rs1.Fields(""HRID"") AND ((ResourceAllocation.[Resource Start Date])<#1/31/2012#) AND ((ResourceAllocation.[Resource End Date])>#1/1/2012#))"
Set rs2 = CurentDb.OpenRecordset("query")
Tables in the database are EmployeeData and ResourceAllocation. HRID is a field set in both tables and the Resource Start Date and Resource End Date fields are both dates we are using for comparisons.