Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass a variable to an SQL stored procedure

Status
Not open for further replies.

mbair

Programmer
Aug 13, 2003
22
US
I need to call an SQL stored procedure and pass it a value and then have the procedure execute. How do I do this from Access????
 
How are you using the stored procedure? What does it return? A resultset or parameter? Is it bound to a Form or Report? Other?
 
mbair,
If you're just running something that executes and doesn't return anything to you, just call it with a pass-thru query.

Assuming the example params fit string data types, adjust for numeric, etc., when you create the string:
Code:
Dim qd as querydef,strSQ as string
set qd = currentdb.querydefs("mypassthru")
strSQ = "Exec dbo.SomeProcedure '" & somevar & "','" & someothervar & "'"
qd.sql = strsq
qd.execute
--jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top