Hi,
I'm having a problem retrieving fields from a recordset when using SQL in access. My code is this
the rs.fields("lastcontactdate") line always seems to bring up an error "Item not found in this collection". Any thoughts on a speedy resolution?Code:varSQL = "SELECT * FROM tblemployees" Set db = CurrentDb Set rs = db.OpenRecordset(varSQL, dbOpenDynaset, dbReadOnly) rs.MoveFirst Do While Not rs.EOF MsgBox rs.Fields("lastcontactdate") If rs.Fields("lastcontactdate") < varCompareDate Then varcount = varcount + 1 rs.MoveNext Else rs.MoveNext End If Loop




Reply With Quote