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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HumanJHawkins

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

    "HumanJHawk ins" <JHawkins@Human itiesSoftware.C om> wrote in message
    news:i9nac.8030 $Dv2.2242@newsr ead2.news.pas.e arthlink.net...[color=blue]
    > (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[/color]
    stored[color=blue]
    > procedure" function that works when there are no parameters is:
    >
    > Dim stProcedureName As String
    > stProcedureName = "CompareLists_T empSolution"
    > DoCmd.OpenStore dProcedure stProcedureName , acViewNormal, acEdit[/color]

    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(sResultFo rm).InputParame ters = 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.


Working...