Retrieving stored procedure output through a recordset


In the function below, I'm attempting to get the returned data from a Sybase stored procedure.   When it's run, I get this error at the dbOpenRecordset:

The Microsoft Office Access database engine cannot find the input table or query 'get_itn 'rule_no', 1'.  Make sure it exists and that its name is spelled correctly. (#3078)

I've confirmed that the stored procedure runs fine at the isql command line on the server, just as it's called:   get_itn 'rule_no',1

Is it not possible to call a stored procedure this way?

Public Function GetItn(pstrColName As String, Optional plngCnt As Long = 1) As Long

   On Error GoTo 0   'force caller to handle any error
   Const strProcedureName = "GetItn"
   Dim rec              As Recordset
   Dim strSQL           As String
   Dim db               As Database
   Set db = CurrentDb
   strSQL = "get_itn '" & pstrColName & "', " & CStr(plngCnt)
   Set rec = db.OpenRecordset(strSQL, dbOpenDynaset)
   If rec.EOF Then
       Assert FAILURE, 101, "No value returned", strProcedureName
   End If

   '*** Return the internal number.
   GetItn = rec.Fields(0)
   On Error Resume Next
   Exit Function
End Function

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Microsoft Access doesn't support the notion of stored procedures - you've only got tables and queries.  However, you should be able to get to your stored procedure using ADO instead of DAO.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You don't even have to use ADO, you can retrieve using DAO but its only read only
I stand corrected!  :-)
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

L_MalchiodiAuthor Commented:
We had done this previously with ODBCDirect, but it's no longer supported in 2007, so I'm trying to figure out another way to accomplish the same thing.   Is there an advantage to executing the stored procedure through DAO, as opposed to ADO?
I dont think there is advantage either way
L_MalchiodiAuthor Commented:
Thank you both!  Maybe I'll try it both ways, see what happens.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.