storedprocedure

  • Thread starter Thread starter jerry
  • Start date Start date
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.
 
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.
 
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.
 
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
 
Back
Top