Stored procedure/adp question

E

EManning

I've got an A2K adp that allows the user to select one or all medical
residents for a report. I'd like to allow the user to select more than one
resident as well. Creating a stored procedure to select just one resident
or selecting all residents is simple. If this were an mdb, I'd construct a
SQL statement that would take all chosen residents and pull just those from
a table. Is there a way to do this in a sp?
 
L

Larry Linson

Why don't you construct the proper SQL and use that as the RecordSource for
the Report instead of worrying about a stored procedure? Just bear in mind
that SQL Server's "flavor" of SQL is a bit different than Access' "flavor"
of SQL (e.g., the "*" wildcard used in Access is "%" in MS SQL Server).

Larry Linson
Microsoft Access MVP
 
E

EManning

Thanks for your reply, Larry. That's what I thought I'd have to do.
However I wanted to make sure there wasn't something I was missing as far as
using a stored procedure for this.
 
L

Lyle Fairfield

I've got an A2K adp that allows the user to select one or all medical
residents for a report. I'd like to allow the user to select more than one
resident as well. Creating a stored procedure to select just one resident
or selecting all residents is simple. If this were an mdb, I'd construct a
SQL statement that would take all chosen residents and pull just those from
a table. Is there a way to do this in a sp?

IN
 
E

EManning

Well, I thought about that but how would I create the list of residents
chosen for the IN statement?
 
R

Robertq

Larry
try changing the where clause to have an or for the
selection values, be sure to put the paren's around the or
statement or it will always return all records

@wantres varchar(30) default ""
select * from myfile
where mycode = (@wantcode or @wantcode = "")

instead of
where mycode = @wantcode
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top