Hi,
I am having my first real stab at calling stored procedures from Access and I am having some difficulty getting past what seems like a silly hurdle.
I have built a very simple stored procedure to return a single value from a table. I have tested the sproc in the query analyser and can return results no problem.
I have put together the following code for testing purpose to call the procedure and although I can compile it I get the error:
"ActiveX component can't create object" with the third line of code [cm.CommandText = "GetContactDisplayName"] highlighted
Is it a reference setting or an MDAC issue or what?
Any ideas would be greatly appreciated.
Many thanks
Dan T
I am having my first real stab at calling stored procedures from Access and I am having some difficulty getting past what seems like a silly hurdle.
I have built a very simple stored procedure to return a single value from a table. I have tested the sproc in the query analyser and can return results no problem.
I have put together the following code for testing purpose to call the procedure and although I can compile it I get the error:
"ActiveX component can't create object" with the third line of code [cm.CommandText = "GetContactDisplayName"] highlighted
Is it a reference setting or an MDAC issue or what?
Any ideas would be greatly appreciated.
Many thanks
Dan T
Dim cm As New ADODB.Command
Dim pm As New ADODB.Parameter
cm.CommandText = "GetContactDisplayName"
cm.CommandType = adCmdStoredProc
Set pm = cm.CreateParameter("CL_ID", adInteger, adParamInput, , intCL_ID)
cm.Parameters.Append pm
Set pm = cm.CreateParameter("CL_DisplayName", adBSTR, adParamOutput)
cm.Parameters.Append pm
cm.ActiveConnection = "Connection string removed"
cm.Execute
Print cm.Parameters("CL_DisplayName")
Last edited: