Sql query based on input box


Im just starting to get to grips with transferring our access db's into sql, and im creatign teh necearry stored procs and views for converting my queries and form basis to run from all going well and using access as a front end client for end users.

I have run into a stubmling block though when using input boxes in queries to set parametres. IN teh below example i am using a between function for dates specified by the user.

I dont want to run teh risk of pulling the whole table to access  and doing the processing client side as some of the pcs re pretty old and naff, but i am unsure how i could write this query as a view or stored procedure and using an input box to pass through teh parametres. im guessing i could use a pass through query into a stored proc but this is where my knowledge is struggling.

Please help!!
SELECT [TBL_delivery details].[Patient Name], [TBL_delivery details].[Ship to], [TBL_delivery details].Unit, [TBL_delivery details].Treatment, [TBL_delivery details].[Delivery date], Format([Delivery date],"dddd") AS [Day], [TBL_delivery details].[Special Reason], [TBL_delivery details].[Delivery not required], [TBL_delivery details].[Quantity Required]
FROM [TBL_delivery details]
WHERE ((([TBL_delivery details].[Delivery date]) Between [Please enter date from] And [Please enter date to]) AND (([TBL_delivery details].[Delivery not required])=False))
ORDER BY [TBL_delivery details].Unit, [TBL_delivery details].[Delivery date];

Open in new window

LVL 25
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I guess you knw the answer. Stored Procedure.
All you need to do is create a sp that will take in the parameters & process the entire thing in the background & return the resultset.
View the Books Online for the syntax.

Bharat Butani.

slam69Author Commented:
sorry im still at a loss for how to generate the parametres in access.

If i write a passthrough query in access how do i get that to accept user input variables

if you can post some syntax for the access based query and then the stored proc for example would be a huge help ;o)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.