Jul 15, 2005 #1 mbair Programmer Joined Aug 13, 2003 Messages 22 Location 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????
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????
Jul 15, 2005 #2 cmmrfrds Programmer Joined Feb 13, 2000 Messages 4,690 Location US How are you using the stored procedure? What does it return? A resultset or parameter? Is it bound to a Form or Report? Other? Upvote 0 Downvote
How are you using the stored procedure? What does it return? A resultset or parameter? Is it bound to a Form or Report? Other?
Jul 16, 2005 #3 jsteph Technical User Joined Oct 24, 2002 Messages 2,562 Location US 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 Upvote 0 Downvote
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