Jim Lawrence (AccessD)
accessd at shaw.ca
Fri May 28 17:57:52 CDT 2004
Hi Charlotte: <comment> Have you tested this, Jim? I thought the .Clone method was for DAO recordsets. You can't just pass an ADO recordset to a DAO recordset unless they've changed something dramatically in the latest MDAC. </comment> No I have not tested the previous piece of code but I have a number of similar pieces of code, in various programs out there. Below is an exact piece just cut and pasted in just for your edification: <code> The Function: Public Function FillFileAgencyData(lngEmployeeNumber As Long) As ADODB.Recordset Dim objCmd As ADODB.Command On Error GoTo Err_FillFileAgencyData Set objCmd = New ADODB.Command With objCmd .ActiveConnection = gstrConnection .CommandText = "REFileAgency" .CommandType = adCmdStoredProc .Parameters.Append .CreateParameter("@EmployeeNumber", adInteger, adParamInput, , lngEmployeeNumber) End With Set FillFileAgencyData = New ADODB.Recordset With FillFileAgencyData .CursorLocation = adUseClient .Open objCmd, , adOpenDynamic, adLockOptimistic End With Exit_FillFileAgencyData: On Error Resume Next Set objCmd = Nothing Exit Function Err_FillFileAgencyData: ShowErrMsg "Module: DataConnection, Function: FillFileAgencyData" Resume Exit_FillFileAgencyData End Function </code> The caller: <code> ... Dim rsFileAgency As New ADODB.Recordset Set rsFileAgency = FillFileAgencyData(typFileAgency.EmployeeNumber).Clone ... </code> ...and it works like a hot D... So even an old master like yourself can learn something. <grin> Jim