storedprocedure

J

jerry

Hi everyone,
Can anyone help me

I just wanted to know if I can run a storedprocedure in a on click event
where the parameter automatically gets a value from a form
Every time the storedprocedure runs it asks for a parameter,that is what I
want to avoid.
 
J

James Goodman

Yes. You can read the value of the control & include this in the SQL
command.

How are you executing the SP?

e.g.
DoCmd.RunSQL "EXEC SomeSP('" & Me.ControlName & "')" 'For a text field.
DoCmd.RunSQL "EXEC SomeSP(" & Me.ControlName & ")" 'For a number field.
 
N

Norman Yuan

Naturally, if a stored procedure requires parameter(s), you need to supply
it(them) to run the SP. Simply write some code in Click event handler (click
event in what kind of program?) to "automatically" pass parameter(s) with
appropriate value(s) to the SP.
 
J

jerry

when I use
DoCmd.RunSQL "EXEC SomeSP(" & Me.ControlName & ")" 'For a number field.
I`m getting a runtime error '170,

'DoCmd.RunSQL "exec dbo.SP_ADD_BETPAYOUT(" & Me.Combo10 & ")"' this is what
I wrote
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top