Passing Text Box Values to a Stored Procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a stored procedure which I run using a pass-through query.
The update only works if I hard code the values I am passing. How can I pass
text box values to the stored procedure so that the query is dynamic?

The name of my stored procedure is 'insert_records', and this is what I
would like to be able to pass:

begin
insert_records(txtBox1.value,txtBox2.value, txtBox3.value, txtBox4.value);
end;

Any help would be greatly appreciated!
Thanks,
Johnny
 
You can change the SQL property of the pass-through query. Code might be
similar to
Currentdb.QueryDefs("qsptMyInsert").SQL ="Exec Insert_Records " & Me.txtBox1
& ", " & Me.txtBox2 & ...""
You might need to concatenate single quotes if some of the control values
are text or dates.
 
Thank you for the response. What exactly does the Querydefs method do?
Also, do I need to create the "qsptMyinsert" query?
 
Thanks alot! I figured it out from your help!

Duane Hookom said:
You can change the SQL property of the pass-through query. Code might be
similar to
Currentdb.QueryDefs("qsptMyInsert").SQL ="Exec Insert_Records " & Me.txtBox1
& ", " & Me.txtBox2 & ...""
You might need to concatenate single quotes if some of the control values
are text or dates.
 
Hi Johnny,

Could you tell me how you figured it out? I'm having the same problem, but
in my case a select statement with criteria.

Greetings,

Jason
 
Back
Top