I've created a function using VBA in MS Access 2010 to execute SQL server stored procedure and return value in ADODB.Recordset Object. However, I'm not able to set the MS Access form RecordSource or Recordset with the recordset that was return from ADODB connection.
Below's you'll find the code excerpt:
Dim objRs As ADODB.Recordset
Set objRs = call_proc("mySQLProc", "param")
Set Forms("form1").Recordset = objRs
Function header of call_proc:
Public Function call_proc(procName As String, procVal As String) As ADODB.Recordset
If I iterate through the objRS and do a Debug.Print I am able to see all the records. So I know the data is there. Just don't know how to fix the error of binding the data to the form. The line of code below returns error:
Set Forms("form1").Recordset = objRs
Any suggesting kindly accepted. Thank you in advance.