Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-03-22
5
Medium Priority
?
1,143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 10651338
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
ID: 10651419
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 1050 total points
ID: 10651541
If security is not an issue you could just build the update stored procedure inline.
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 450 total points
ID: 10651557
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
ID: 10651607
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 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