By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,311 Members | 1,844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,311 IT Pros & Developers. It's quick & easy.

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

P: n/a
"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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.