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!

Calling a stored procedure from VBA

Status
Not open for further replies.

markSaunders

Programmer
Jun 23, 2000
196
GB
I have an application in VBA (word2000) and have managed to get my first recordset form the standard SQL(2000) SELECT statement.

I now need to run a stored procedure, passing in the paramaters selected by the user.

I have everything setup except the actual syntax for calling a SQL Stored Proc.

any help/advice/pointers would be appreciated

cheers
mark Mark Saunders :)
 
Try something like

sql = "exec mystoredproc numberparam, 'stringparam'"

Set myRecordSet = New ADODB.Recordset

myRecordSet.Open sql, myConnection

... or delve into the mysteries of the ADO Command and Parameter objects (which you may just find to be more trouble than you need right now!)

HTH
 
If you are really up for the Command and Parameter objects (which is what you need to use to pass parameters into and receive them back from a SQL Server stored procedure), see the following thread. If you still need help, copy and paste what doesn't make sense here, and we can look at it for you.

thread705-242764 Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top