Unanswered: Calling Stored Proc. with optional parameter
I have an Access 2000 ADP that is linked to an SQL server database. I am trying to execute a stored proc. that has parameters with default values specified from within VBA code.
I was under the impression that if I specify which parameters I am adding by using the ado command object, that I would not have to pass in all of the parameters, rather I could specify the name of the parameter, and its value, and it would be set. When I try to do this however, if I have 5 parameters, and set 3 of them using the createparameter, it is the first 3 that are set, not the named ones that I specify.
Do I have the wrong impression about how this works??
I am using the commands as shown below...
stored proc defined as:
Create proc SP (@value1 int = 0, @value2 int = 1, @value3 int = 2)
yeah - thanks....have since found out that you are right using the method that I put in the code sample, however it is possible can do it by adding the parameters by name as follows:
adoCmd.Parameters("@Value3") = 100
This then sets the value of the specific parameter.