OK, so I'm not the smartest cookie in the jar and sometimes can't let go. I have a piece of code that had been working for years that just started generating the error recently.
Dim rs2 As Recordset
Set rs2 = Me!sfrmReviewQuote.Form.RecordsetClone
strRecordCriteria = ("[LOT_NUMBER] = '" & "NEW" & "'")
rs2.FindFirst strRecordCriteria <--------
(sfrmReviewQuote is based upon query qryQuoteLineItems)
The fist time this code is run it works fine. The subsequent code adds records to a copule of tables and opens a Purchase order form. Once the PO form is closed focus is returned to this sales order form. If the user attempts to generate another PO for additional product the error occurs here
I've worked around the problem by
Dim qdf2 As DAO.QueryDef
Set qdf2 = db.QueryDefs("qryQuoteLineItems")
qdf2.Parameters("[forms]![frmSalesLineItems]![txtQuoteNumber]") = Me!txtQuoteNumber
Set rs2 = qdf2.OpenRecordset()
but I really want to know why the original is now failing. I've been looking through code for 2 days trying to find anything I have changed (nothing). A KB search returns one article describing how this error is generated by
Set rs = CurrentDb.OpenRecordset("tblName")
Set db = CurrentDb
Set rs = db.OpenRecordset("tblName")
but do not have any instances in my project. Also, I've seen a suggestion that closing the default workspace variable while a RecordsetClone object is open can cause this error but none of the subsequent code (in any of the forms, functions or procedures) sets/closes a workspace variable.
Anyone experience this particular error? Can anyone shed some light on using RecordsetClone to assign a recordset?
FYI - the sales order form remains open the entire time; the object variables are closed at the end of the procedure where the problem code exists, i.e. first time through the QueryDef, recordset and database object variables are closed.
Thanks in Advance,