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

parameters in stored procedure

Status
Not open for further replies.

jem1968

Programmer
Feb 14, 2005
3
US
Hello. I have been developing in Access (Jet) for years and am trying to make the leap into sql server. In Jet, I have often used an unbound form that users can select various criteria to generate a report. The queries reference those form fields. I would like to use a similar process in an ADP. I have a series of stored procedures that i want to append data to another table based on criteria selected (or left null) in a form. In the stored procedures i have set up these parameters, each one is nvarchar and can contain a value or be null:

@city
@country
@investortype
@fundcategory

Now, i am not clear on how to send these parameters to the query from the form code or how to reference them and indicate that

@city = Forms!fldgRunCustomReport!cboCity
@country = Forms!fldgRunCustomReport!cboCountry

and so on. Any help would be greatly appreciated!!!

Thanks.
 
Look under the data tab on the Report.

In the source put the sproc name.
dbo.yoursproc

In the Input Paramters put the parameters separated by comma.

@city = Forms!fldgRunCustomReport!cboCity,@country = Forms!fldgRunCustomReport!cboCountry

Depending on how the parameters are defined in the sproc it may be necessary to include all the parameters. The default is input parameter for output parameter designate as such.




 
Thanks for the response. I tried this and unfortunately it won't work because the report doesn't come into play until late in the game...the stored procedures are selecting data based on the criteria entered into the form and dumping it into another table, a temporary table. The temporary table, or actually a stored procedure based on that table, is used as the record source for the report. So, what i need is to send the parameters to the 'appending' stored procedures from the form code.
 
Use the ADO Command object to call stored procedures with parameters.

See this thread958-1005576 for an example.
 
Thanks! I figured it out and it works great now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top