news:i9*****************@newsread2.news.pas.earthl ink.net...
(The SQL Group suggested I post this here... Sorry for the disconnected
cross-post)
Hi,
I am trying to connect a form in an access data project to a stored
procedure on our SQL server.
Without parameters, all I have to do is make a button on the form with a
"run stored procedure" function attached to it. The code in the "run stored procedure" function that works when there are no parameters is:
Dim stProcedureName As String
stProcedureName = "CompareLists_TempSolution"
DoCmd.OpenStoredProcedure stProcedureName , acViewNormal, acEdit
Thanks for the suggestions. The answer turns out to be:
Make the stored procedure the data source for a form. Then put the
parameters into the InputParameters for that form. For example:
sParams = "@Name varchar(16) = '" & sName & "'" & ", @Number Integer = "
& iNumber
DoCmd.OpenForm sResultForm, acFormDS
Forms(sResultForm).InputParameters = sParams
This actually loads the form with default parameters, then reloads with the
correct parameters. So, make sure the default paramters result in a very
fast return time.