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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sp_sqlexec 2

Status
Not open for further replies.

grnzbra

Programmer
Joined
Mar 12, 2002
Messages
1,273
Location
US
I need to pass an entire WHERE clause into a stored procedure. Did a search and found someone recommended using sp_sqlexec. I looked it up in Books Online and the reference said:

"Removed; no longer available. Remove all references to sp_sqlexec."

I am using SQL Server 2000 in Windows XP. Can anyone suggest how to pass in an entire WHERE clause to a stored procedure?
 
You can change the SQL property of a pass-through query with code like:
Dim strSQL as String
strSQL = "exec sp_MyProcedure '" & Me.txtEndDate & _
"', '" & Me.txtDept & "'"
CurrentDb.QueryDefs("qsptMyPT").SQL = strSQL


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thank you both.

The sp_executesql works very nicely.


I'm doing this with unbound forms. The VBA code works very nicely with both Access and SQLServer back ends. Am I engaging in overkill by trying to do it with a sp?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top