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.
James Goodman - 31 May 2005 15:36 GMT
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.

Signature
Cheers,
James Goodman
> Hi everyone,
> Can anyone help me
[quoted text clipped - 3 lines]
> Every time the storedprocedure runs it asks for a parameter,that is what I
> want to avoid.
jerry - 31 May 2005 15:56 GMT
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
> Yes. You can read the value of the control & include this in the SQL
> command.
[quoted text clipped - 16 lines]
> > Every time the storedprocedure runs it asks for a parameter,that is what I
> > want to avoid.
jerry - 31 May 2005 16:04 GMT
Thanks man,after reading your message again I got success,thanks a lot
Jerry
> when I use
> DoCmd.RunSQL "EXEC SomeSP(" & Me.ControlName & ")" 'For a number field.
[quoted text clipped - 24 lines]
> I
> > > want to avoid.
Norman Yuan - 31 May 2005 15:38 GMT
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.
> Hi everyone,
> Can anyone help me
[quoted text clipped - 3 lines]
> Every time the storedprocedure runs it asks for a parameter,that is what I
> want to avoid.