472,127 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

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 2639

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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.