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

Parameter in a stored procedure...

Status
Not open for further replies.

PNC

MIS
Jun 7, 2001
87
US
Hi,

I'm trying to built a pass-through query who's executing a stored procedure in SQL server with a parameter that the user can enter like in a Access Query.

ACCESS:
EXEC dbo.Myproc '[Parameter/project]'

-----

SQL SERVER:
CREATE PROCEDURE Myproc
@project varchar(50)
AS
SELECT field FROM table WHERE field like @Project
GO
 
You can use DAO code to change the SQL property of a saved pass-through query. For instance if you have a combo box "cboProject" on a form, add code to the form in the after update event of cboProject:
Code:
   Currentdb.QueryDefs("qsptYoursHere").SQL = "EXEC dbo.Myproc '" & _
        Me.cboProject & "'"

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top