469,603 Members | 2,076 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

Solution (Was: Calling Stored Procedure with Paramaters from ADP / Visual Basic)

"HumanJHawkins" <JH******@HumanitiesSoftware.Com> wrote in message
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.
Nov 12 '05 #1
0 2568

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Brad H McCollum | last post: by
2 posts views Thread by Dino L. | last post: by
2 posts views Thread by Woody Splawn | last post: by
4 posts views Thread by dawson | last post: by
1 post views Thread by endriu | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.