Solved

Using named parameters with stored procedures (ADO 2.7, Access ADP, SQL SVR 2000  and VBA)

Posted on 2004-03-22
5
1,100 Views
Last Modified: 2013-12-25
I was under the impression that utilizing named parameters I could only specify the parameters needed and execute with those leaving others blank.

I have a large Access form that I need to be able to save as incomplete and come back to it later to finish. I have update and insert stored procedures defined to do this and I am using code to create and append parameters to the appropriate stored procedure as necessary. However, I am getting an error that the stored procedure expects a parameter that was not supplied.

I am thinking that I need default values but am not sure how to use the value already in the table or Null as default.
0
Comment
Question by:SEANWYATT
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:SRigney
Comment Utility
You will still need to create all of the parameters, but if the stored procedure is set up to use defaults then you only have to set the ones that you are using.
0
 

Author Comment

by:SEANWYATT
Comment Utility
So If I set the defaults to Null in the stored procedure, I need to loop through all the controls on the form before executing the update to add the parameters and not just the fields that were changed on the current visit. That is going to be an interesting project... Is there a better way to handle this?
0
 
LVL 15

Accepted Solution

by:
SRigney earned 350 total points
Comment Utility
If security is not an issue you could just build the update stored procedure inline.
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 150 total points
Comment Utility
you could try constructing just 1 delimited input parameter to the stored procedure
and then let the stored procedure decode it...

e.g.

'1|22222|SMITH & JONES|'


i'd use | rather than a comma as its a better choice of a non allowed user input character...

hth  
0
 

Author Comment

by:SEANWYATT
Comment Utility
I guess the best way would be to build a parameter array by going through the controls and adding the control value or "" to the array.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now